• If you look here: http://freelance.tstwebdesign.co.uk/news/ only one post is showing but I’m looking for all the posts in that category to show up.

    The PHP I’m using:

    <?php if ( have_posts() ) : ?>
    
    			<?php /* The loop */ ?>
    
    			<?php while ( have_posts() ) : the_post(); ?>
    				<?php get_template_part( 'content', get_post_format() ); ?>
    			<?php endwhile; ?>
    
    			<div>
        <?php the_post_thumbnail( 'category-thumb' ); ?>
    		<div class="postdate"><?php the_date(); ?></div>
    		<div class="posttitle"><a href="<?php the_permalink() ?>"><h3><?php the_title(); ?></h3></a></div>
    		<?php the_excerpt(); ?>
    	</div>
    
    		<?php else : ?>
    			<?php get_template_part( 'content', 'none' ); ?>
    		<?php endif; ?>

    Any help appreciated!

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hi,
    In which file is this code?
    You need to add:
    query_posts('cat=x');
    before if ( have_posts() ) :
    Replace ‘x’ with the category ID of the category you’d like to display

    The PHP I’m using

    is that category.php?

    why is this section after the ‘endwhile’ of the loop?

    <div>
        <?php the_post_thumbnail( 'category-thumb' ); ?>
    		<div class="postdate"><?php the_date(); ?></div>
    		<div class="posttitle"><a href="<?php the_permalink() ?>"><h3><?php the_title(); ?></h3></a></div>
    		<?php the_excerpt(); ?>
    	</div>

    does your theme have a content.php?

    what are your settings under dashboard – settings – reading blog pages show at most …. posts?

    if you need to keep the setting there for any reason, do not add a query into category.php; consider using ‘pre_get_posts’ instead; http://codex.wordpress.org/Plugin_API/Action_Reference/pre_get_posts

    Thread Starter tommyleyland

    (@tommyleyland)

    The code I use at the moment gets the correct category posts, it just only shows 1 post for some reason. I would quite like to keep it like that instead of having to put in the category ID everytime I make a new category.

    My page doesn’t have a content.php, what does that page do again?

    what are your settings under dashboard – settings – reading – blog pages show at most …. posts?

    Is says 10.

    Thanks for your help.

    The PHP I’m using:

    in what file is the posted code?

    what is the full code of the template?

    what happens if you temporarily switch to one of the default themes like Twenty Twelve?

    what happens if you temporarily deactivate all plugins?

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Show All Category Posts’ is closed to new replies.