Forums

Create an archive by category sorted by date (6 posts)

  1. tiosolid
    Member
    Posted 3 years ago #

    Hi, I know I can access my categories archive by going to http://www.site.com/category/category_name and my global category using http://www.site.com/year/month, but is there any way to merge the urls to display a year/month archive from only one category?

    My idea is to create an archive based of categories. Like:

    Category X
    Posts from 2008: Jan (link to the archive), Feb (link), ...

    Category Y
    Posts from 2007: Jan (link to the archive), Feb (link), ...

    and so on. Is there any way to acomplish this without specific wordpress code? If not, could anybody paste some code that would allow me to do that?

  2. MadsK
    Member
    Posted 3 years ago #

    I think you should be able to insert this code.

    // Get the last 10 posts in the special_cat category.
    <?php query_posts('category_name=special_cat&showposts=10'); ?>

    <?php while (have_posts()) : the_post(); ?>
    <!-- Do special_cat stuff... -->
    <?php endwhile;?>

  3. tiosolid
    Member
    Posted 3 years ago #

    Thanks, but I still cant "filter" the posts by date ;/

    Is there any way to pass dates to the showposts parameter?

  4. MadsK
    Member
    Posted 3 years ago #

    You can add this :)

    orderby=date

    // Get the last 10 posts in the special_cat category.
    <?php query_posts('category_name=special_cat&showposts=10&orderby=date'); ?>

    <?php while (have_posts()) : the_post(); ?>
    <!-- Do special_cat stuff... -->
    <?php endwhile;?>

  5. tiosolid
    Member
    Posted 3 years ago #

    Thanks! The query_posts() function is exactly what i Need, just need to call it this way:
    query_posts('cat=3&year=2004');

  6. jennag
    Member
    Posted 2 years ago #

    This is exactly what I need, but I would like to limit my archive from the archive widget to one category. Can I use this code to help?

    Thanks!

Topic Closed

This topic has been closed to new replies.

About this Topic