Support » Fixing WordPress » wp_query in sidebar doesnt show on posts page

  • hi,
    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 and

    the thing is for some reason the sidebar query does what its supposed to do on any page other than the posts page

    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,


Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘wp_query in sidebar doesnt show on posts page’ is closed to new replies.