• Hello, I am trying to show a single category in a new template page I created (using a few tutorials)

    For the life of me, I can’t get it to show only the posts in a single category (category 26).

    Right now the page template works but it shows ALL the categories posts instead of the one category I need.

    This is my code that calls the posts

    <?php
    
    	    	$post = $wp_query->post;
    
    	   	 	$limit = get_settings('posts_per_page');
    
    			$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    
    			query_posts('showposts='.$limit.'&paged=' . $paged);
    
    			while (have_posts()) : the_post(); 
    
    			?>

    Does anyone know what I am doing wrong? Any help will be greatly appreciated.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter yaptalk

    (@yaptalk)

    FIXED

    Replaced

    query_posts('showposts='.$limit.'&paged=' . $paged);

    with

    query_posts("cat=$26&paged=$paged");

    and now the template I made only shows one category’s posts!

    Thanks for posting the answer. This was exactly what I was looking for. I appreciate that you followed up on your own question!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Trying to show only ONE category post in page template’ is closed to new replies.