Forums

make an order between articles in a specific category (2 posts)

  1. brestolo
    Member
    Posted 1 year ago #

    how order the articles in a specific category?
    I show my problem:
    I need a category different from the others,
    because i have not a category file but i have the archive.php I have understood that i have to copy the archive.php and rename it in archive-2.php right?

    Wich code i have to add in archive.php to call the archive-2.php?

    I want my category (called archive-2.php) make it in reverse chronological order (from the oldest to the newest one articles) but how to do this?

    How make the the "archive-2.php" corresponds to the category i desire?

    thank you

  2. esmi
    Theme Diva & Forum Moderator
    Posted 1 year ago #

    I have understood that i have to copy the archive.php and rename it in archive-2.php right?

    No. Assuming your chosen category has the slug foo, you need to rename the new file category-foo.php. See Category_Templates for the full explanation.

    Once you have your new category template file, you need to add a custom query just before the Loop - such as:

    <?php
    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    $args= array(
    	'orderby' => 'date',
    	'order' => 'ASC',
    	'paged' => $paged
    );
    query_posts($args);
    ?>

    `

Topic Closed

This topic has been closed to new replies.

About this Topic