tiosolid
Member
Posted 11 months 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?
MadsK
Member
Posted 11 months 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;?>
tiosolid
Member
Posted 11 months ago #
Thanks, but I still cant "filter" the posts by date ;/
Is there any way to pass dates to the showposts parameter?
MadsK
Member
Posted 11 months 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;?>
tiosolid
Member
Posted 11 months ago #
Thanks! The query_posts() function is exactly what i Need, just need to call it this way:
query_posts('cat=3&year=2004');
jennag
Member
Posted 5 months 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!