I am having issues while trying to build up a following query in WordPress using the tag_id as a filter:
<?php
$the_query = new WP_Query( array (
'posts_per_page' => '-1',
'tag_id' => ''
) );
while ( $the_query->have_posts() ) : $the_query->the_post();
?>
As you can see, the “tag_id” value is empty because I am trying to retrieve the value from here:
<?php echo of_get_option('slideshow-tags', 'no entry' ); ?>
This echo is returning a value so it works but I don’t know how to adapt this to the query without getting php errors.
I tried:
<?php
$the_query = new WP_Query( array (
'posts_per_page' => '-1',
'tag_id' => 'echo of_get_option('slideshow-tags', 'no entry' ); '
) );
while ( $the_query->have_posts() ) : $the_query->the_post();
?>
but it won’t work.
You don’t want to
echothe returned value ofof_get_option, you want to use it in your array: