WordPress.org

Ready to get started?Download WordPress

Forums

Displaying Monthly Archives in category group (7 posts)

  1. martiniboy
    Member
    Posted 3 years ago #

    I have been having a problem with my archive page. The problem is I call for my archives from the sidebar by each month and when a month is clicked I would like to display the posts from that month which is straight forward but then would like to have the posts separated by what category they are in.
    i.e
    Archive For October 2010

    Presentations (title of category)
    -Post title October 2nd
    -Post title October 10th

    News (Title of another Category)
    -News Post title October 6th
    -News Post Title October 11th

    etc...
    But everytime I try to add a query to display by Category it cancels out the monthly query or vice-versa. Is it possible to display the posts within to criterias?

    Any Help would be appreciated, please!

  2. vtxyzzy
    Member
    Posted 3 years ago #

    It should be possible, but might require a bit of coding. Can you post your monthly archive code in the pastebin and post a link to it here?

    If you are using a free theme, a link to your site might help.

  3. martiniboy
    Member
    Posted 3 years ago #

    This is an excerpt of the code used on my arhive.php but am not sure how to make it display the posts within categories. I am useing a custom built theme and the page which I am working on is for members only so unfortunately cannot put link to site

    <?php if (have_posts()) : ?>
    <?php $post = $posts[0]; ?>
    <?php /* If this is a monthly archive */ } if (is_month()) { ?>
    <h2 class="pagetitle">Selected Month: <?php the_time('F, Y'); ?></h2>
    <?php } ?>

    <div id="newsfeed">

    <?php endif; ?>

  4. vtxyzzy
    Member
    Posted 3 years ago #

    First, any time you post code here, enclose it in backticks!!

    What you have shown is not enough to be sure, but it appears that the posts may not be sorted in category order. Until they are sorted by category, you cannot do what you requested.

    Please post the entire archive.php in the pastebin and post a link to it here.

  5. vtxyzzy
    Member
    Posted 3 years ago #

    I just found this link that says you can't sort posts by category.

  6. vtxyzzy
    Member
    Posted 3 years ago #

    Actually, I think it is possible, just not simple. Email me at mac =at= mcdspot =dot= com if you wish to pursue this.

  7. syed544
    Member
    Posted 3 years ago #

    @ vtxyzzy:
    You solved this same type problem [as that of martiniboy] for me. You deserve my hearty THANKS!!

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.