I am using the following code in a widget that displays the posts in that category, but when I view that link by clicking it, it disapears from the menu/list.

Take a look here

$my_query = new WP_Query("category_name=$pagename&showposts=200&orderby=title&order=ASC"); ?>
<?php while ($my_query->have_posts()) : $my_query->the_post(); ?>
<li><a href="<?php the_permalink() ?>" title="<?php the_title(); ?>">
<?php the_title(); ?></a></li>
<?php endwhile; ?>

I want the list static, not keep changing. How?

  • 1
    Disappears from what menu/list? Hint: Your question should work without any outside link provided.
    – kaiser
    Apr 21 '14 at 0:38
  • 1
    What is $pagename here? Apr 21 '14 at 5:50
  • If $pagename changes the list will change. That is how you've written the code. How is that ever going to be "static"?
    – s_ha_dum
    Apr 21 '14 at 13:38
  • current selected item is been disappearing. So please check in functions.php or any other plugin whether any hook are written for this. Because your code is correct and working fine. But someother stuff is making the problem. Apr 21 '14 at 14:06
  • No way to say from this code, it shouldn't happen. Are you filtering queries for any purpose?
    – Rarst
    Apr 21 '14 at 17:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.