WordPress.org

Ready to get started?Download WordPress

Forums

Single.php showing all posts? (5 posts)

  1. MatthewRuddy
    Member
    Posted 3 years ago #

    For some reason my page single.php is showing all the post from a category instead of just a single post! I cannot figure out why this is at all. Am I missing some code?

    <?php get_header(); ?>
    <div id="container">
    <?php if(have_posts()) : ?>
    <?php while(have_posts()) : the_post(); ?>
    <h2><?php the_title(); ?></h2>
    <?php the_content(); ?>
    <?php endwhile; ?>
    <?php endif; ?>
    </div>
    <?php get_footer(); ?>

    The post in question: http://easingslider.matthewruddy.com/screenshots.

    I want it to display the screenshots post but instead it is displaying all the posts from that category. Really would appreciate if anyone could help me fix this.. Thanks.

  2. Yoris
    Member
    Posted 3 years ago #

    I think it might be in the link you're using.

    I would expect a link to a single post to look like this:
    http://easingslider.matthewruddy.com/category-name/post-title

    You could test this by making your post titles into links, to see what link you get then.
    <h4><a href=”<?php the_permalink(); ?>“><?php the_title(); ?></a></h4>

  3. MatthewRuddy
    Member
    Posted 3 years ago #

    Tried that, no luck.

    Try it yourself : http://easingslider.matthewruddy.com ; the title links just link to a page displaying all the posts..

  4. Yoris
    Member
    Posted 3 years ago #

    I don't know what you did, but http://easingslider.matthewruddy.com/screenshots seems to be displaying only the screenshots now. So I guess it's working...
    Did you figure out what was wrong?

  5. MatthewRuddy
    Member
    Posted 3 years ago #

    Yeah. I had used;

    <?php if(have_posts()) : ?>
    <?php while(have_posts()) : the_post(); ?></code

    in the header as a navigation (displaying only the titles) which seemed to break things. Fixed it now though.

    Thanks.

Topic Closed

This topic has been closed to new replies.

About this Topic