WordPress.org

Ready to get started?Download WordPress

Forums

how to use category AND archive templates (6 posts)

  1. joand
    Member
    Posted 7 years ago #

    I am using a category specific template (category-2.php) to display a category (plus the post-templates-by-cat plugin to display the posts for that cat using single-cat-2.php). I would also like to display the archives of this category differently - e.g. by date and title. I can't use the archive template, since there is a category template. I have seen some plugins here to create an archive PAGE, but I do not want to create a page as I don't want it to show up in the menu (except in this category). I would be okay with "hard coding" it into the above mentioned category 2 templates if there is a way to do it. i.e. what I would want the code to do (in English) is "please select the posts from category 2 and display them in the archive.php template" Is there a way to translate this into PHP that someone could explain to me? (I am pretty good with English - with PHP...not so much...)

    Thanks,
    Joan

  2. PozHonks
    Member
    Posted 7 years ago #

    Are the parameters of the get_posts template tag not satisfactory?
    http://codex.wordpress.org/Template_Tags/get_posts

  3. joand
    Member
    Posted 7 years ago #

    It looks like it would kind of work, thanks. Currently I have the site configured to show 10 posts per page, so it looks like I could have the first page showing the full length post and then the remainder as a kind of "archive" that would go on the next page. I guess that would then only show 10 per page - that wouldn't be so good...

  4. joand
    Member
    Posted 7 years ago #

    This is what I want:
    http://codex.wordpress.org/Template_Tags/wp_list_cats
    where it says there is a "file" parameter, but it doesn't work. I put in file=archive.php, but it continues to use the category-2.php template.

  5. moshu
    Member
    Posted 7 years ago #

  6. joand
    Member
    Posted 7 years ago #

    Well I think I did it right as per the instructions above for "Tags with query-string-style parameters". Here is what I have: <?php wp_list_cats('file=archive.php&exclude=1&use_desc_for_title=0'); ?>

    The other 2 parameters are being followed correctly. Does the file need more of a path to it? There are no examples - it just says "The php file a Category link is to be displayed on. Defaults to index.php."

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags