I'm showing a grid of posts with get_posts() function and trying to control category parameter value from a custom field.
my code works if category parameter gets value from echo function for example:
$args = array(
'numberposts' => 6,
'category' => '<?php echo "25";?>'
,);
but it doesn't when I do something like
$catid = get_field( "id_of_product_category" );
$args = array(
'numberposts' => 6,
'category' => '<?php echo $catid;?>'
,);
at the same time I'am able to
echo $catid;
on the page and it does show correct value set in custom field.
Why I can't get it to work to change category parameter then?