Reputation: 341
I have a custom field as an option, and I want to put the value of this option in a custom loop.
So here's what I have:
$CatTxt = the_field('section_1', 'option');
echo $CatTxt;
This works, the problem is when I try to put on the loop. My attempts:
Double quotes - doesn't work:
<?php query_posts("category_name=$CatTxt"); ?>
Separating with the dot - Doesn't' work:
<?php query_posts('category_name='.$CatTxt); ?>
Any idea on how to make this work? Thanks!
Upvotes: 1
Views: 198
Reputation: 119
Try this now please:
<?php query_posts('category_name='.'"$CatTxt"'); ?>
Upvotes: 1