Support » Fixing WordPress » wp_query in sidebar doesnt show on posts page
8 years, 7 months ago
i am running this query in sidebar to get a featured post from a set category.
<?php $recent = new WP_Query('cat=298&showposts=1'); global $wp_query; $wp_query->in_the_loop = true; $wp_query->is_page = false; $wp_query->is_category = false; ?>
<?php while ($recent->have_posts()) : $recent->the_post(); ?>
<!-- do something -->
<?php endwhile; ?>
my homepage is set to a page page and posts to another page. see pact.lk and pact.lk/timeline
the thing is for some reason the sidebar query does what its supposed to do on any page other than the posts page pact.lk/timeline.
i really don tget it. have tried putting all sort of conditional tags but none work for this page. is_home, is_front_page nothing.
can anyone help out? there was a guy who asked the same thing 8 months ago and no solution came. he solved it doing some other trick with if else logic but he didnt post the solution.
thank you for your help,
no one there to help a wp bro?
this is important.