Single.php showing all posts? (5 posts)

  1. MatthewRuddy
    Posted 6 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; ?>
    <?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
    Posted 6 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:

    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
    Posted 6 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
    Posted 6 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
    Posted 6 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.


Topic Closed

This topic has been closed to new replies.

About this Topic