My site is giving me problems when I try to edit the sidebar. What I am trying to do is create a post listing of posts that I consider to be popular. I tagged a few posts with the category "popular" and then found this code to use in order to display a list.
<?php query_posts('category_name=Popular&showposts=5'); while (have_posts()) : the_post(); ?> <li><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?> <?php comments_number('0', '1', '%'); ?></a></li> <?php endwhile; ?>
I have tried this through two different ways. First I tried widgets, and found a widget which enabled PHP to be used in a text bar. I pasted the code in and it worked great, but the problem is suddenly the body of my home page shows only the posts in the sidebar, AKA only posts i have tagged "popular" are showing up on my front page, not all my posts. For some reason maybe the index.php or something is reading the php from the sidebar and decides to display the posts in the body as well. I just wanted to have a list in a sidebar to show what I think has been popular.
I also tried putting the PHP directly in my sidebar.php, before the dynamic sidebar begins, this worked as well, but also resulted in the body displaying only popular posts.
Can anyone help me figure out why adding this PHP is causing this weird occurence? Right now my site is running without the PHP added, but if you want to see the site with the PHP added let me know. Thanks!