Forums

[resolved] single.php showing all posts (11 posts)

  1. Empireoflight
    Member
    Posted 1 year ago #

    Hi, weird problem-when someone clicks on a post link, they see all the posts (in the "values" category, that is). Please see:
    http://stevespets.com/
    and click on one of the links on the left side.

  2. esmi
    Theme Diva & Forum Moderator
    Posted 1 year ago #

    I think there's something seriously wrong in your theme as a whole. Many of the links on your top nav are pointing to files in /wp-content/themes/

    Perhaps you need to review Theme_Development?

  3. Empireoflight
    Member
    Posted 1 year ago #

    esmi, can you be more specific? I don't see any links with href's containing /wp-content/themes in the nav div...

    My single.php file is as simple as can be:

    <?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
    <h3><?php the_title(); ?></h3>
    <?php the_content(); ?>
    <?php endwhile; // end of the loop. ?>

    and it's definitely being called by the single blog posts.

  4. Empireoflight
    Member
    Posted 1 year ago #

    Oh, scratch that-I was mucking around and now the links are broken..hold on

  5. esmi
    Theme Diva & Forum Moderator
    Posted 1 year ago #

  6. Empireoflight
    Member
    Posted 1 year ago #

    OK, links are fixed-any ideas about why single.php isn't working?

  7. esmi
    Theme Diva & Forum Moderator
    Posted 1 year ago #

    Are you running more than one Loop using something like query_posts (perhaps in the sidebar)? That could be messing up the Loop in single.php - especially if you've forgotten to use wp_reset_query between the Loops.

  8. Empireoflight
    Member
    Posted 1 year ago #

    Thanks esmi; I'm not using a sidebar per se, it's built into header.php:
    Here's what I have there:

    <?php
    query_posts('category_name=values&showposts=5');
    while (have_posts()) : the_post();?>
    <div class="postEntry" >
    <div class="date">
    <?php the_date('m/d/y');?>
    </div><!-- end date  -->
    <a href="<?php the_permalink();?>" title="<?php the_title(); ?>" class="title"><?php the_title();?></a>
    <p><?php excerpt('25'); //content excerpt plugin function ?>
    </div></p>
    <?php endwhile; ?>
  9. esmi
    Theme Diva & Forum Moderator
    Posted 1 year ago #

    That may be the problem. Ideally, you should be using get_posts for secondary Loops but you might be able to get away with simply using wp_reset_query() after the Loop in header.php.

    Also have a look at this Codex page on multiple Loops.

  10. Empireoflight
    Member
    Posted 1 year ago #

    Thanks esmi-that did it! I added wp_reset_query() right after endwhile; and now it's right on.
    I'll definitely look over the codex, I need to get more familiar with this stuff...

  11. esmi
    Theme Diva & Forum Moderator
    Posted 1 year ago #

    Glad to have helped. :-)

Topic Closed

This topic has been closed to new replies.

About this Topic