Forums

Trying to show only ONE category post in page template (2 posts)

  1. yaptalk
    Member
    Posted 2 months ago #

    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.

  2. yaptalk
    Member
    Posted 2 months ago #

    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!

Reply

You must log in to post.

About this Topic