Forums

[resolved] Category.php showing wrong posts (6 posts)

  1. jessn
    Member
    Posted 2 years ago #

    Hi guys! I'm having an issue with my category.php page. Whenever you click a category link, such as "this post was filed under music", it takes you to the category.php where it's supposed to pull up all posts filed under that category. However it never works like that. No matter what category you click it always pulls up posts filed under one particular category and I can't figure out why!

    Here's what I've got:

    <?php if (have_posts()) : ?>
    <?php while (have_posts()) : the_post(); ?>
    
    <h2 id="post-<?php the_ID(); ?>" ><a href="<?php echo get_permalink() ?>" rel="bookmark" title="Permanent Link: <?php the_title(); ?>"><?php the_title(); ?></a></h2>
    
    <?php content('30'); ?>
    
    	</div>
            <?php endwhile; endif; ?>

    Seems fine to me...Anyone have any idea why this wouldn't work?

  2. MichaelH
    Volunteer
    Posted 2 years ago #

    replace

    <?php content('30'); ?>

    with

    <?php the_content(); ?>

    See the_content()

  3. jessn
    Member
    Posted 2 years ago #

    Right, that's from a plugin that helps limit the content length and it works fine but just in case I tried replacing it with the_content and that didn't fix the problem. It's still pulling up the wrong posts.

  4. MichaelH
    Volunteer
    Posted 2 years ago #

    Could be something else messing with your $posts values...like a query in your sidebar?

    Also want to make sure a plugin is not causing a problem.

    If you switch to the WordPress Default theme do the category archives show properly?

  5. jessn
    Member
    Posted 2 years ago #

    Aha! Good call. Yes when I change the theme the categories.php file works fine. I wonder what could be causing that in my theme files...

  6. jessn
    Member
    Posted 2 years ago #

    It was something in the sidebar. Thanks for the pointers!

Topic Closed

This topic has been closed to new replies.

About this Topic