Body of my site is duplicating a sidebar widget
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!
Are you trying to list posts that you want to show as popular, or show posts that are popular by virtue of how many views they’ve had? There are a couple of plugins that do a very nice job of displaying “most popular” posts based on views…
Trying to show posts that I view as popular, I wanted to have more control over what shows there. But I may just end up using a plugin if this doesn’t work out. This is the website http://www.pearsonified.com/2008/02/what_every_blogger_needs_to_know_about_categories.php#more-290 where I originally read about the idea.
- The topic ‘Body of my site is duplicating a sidebar widget’ is closed to new replies.