Forums

how to use paged in category-{slug}.php (2 posts)

  1. fumocamel
    Member
    Posted 1 year ago #

    hi,
    i do a category-{slug}.php page called category-writing.php
    with this code

    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    $args = array(
    	'posts_per_page' => 1,
    	'category_name'  =>writing,
    	'orderby' => title,
    	'order' => DESC,
    	'paged'=>$paged
    );
    query_posts($args);
    if ( have_posts() ) : while ( have_posts() ) : the_post();
    $post_id_image=$post->ID;
    the_content('');
    
    previous_posts_link();
    next_posts_link();

    the first page work
    http://mywebsite.com/category/projects/writing/
    i need 1 post per page

    but when i click to next post
    i got this link
    http://mywebsite.com/category/projects/writing/page/2/

    but i get the index.php not my category-writing.php

    what's wrong?

  2. fumocamel
    Member
    Posted 1 year ago #

    i change
    Blog pages show at most
    in settings->Reading section in back end

    and works

    but if i need another category page
    how to set how many posts per page?

    thanks

Topic Closed

This topic has been closed to new replies.

About this Topic