WordPress.org

Ready to get started?Download WordPress

Forums

Archive page and tags (4 posts)

  1. jessn
    Member
    Posted 4 years ago #

    Hey guys! I have an archives page and it's set up to show a list of categories and how many posts they contain. However when someone clicks on one of the tags listed by the_tags instead I want the archives page to show all posts that have that tag. I'm just not sure how to write the conditional statement "if it's a tag archive, do this, otherwise do this".

    Any ideas?

  2. MichaelH
    Member
    Posted 4 years ago #

    Look at the is_tag() conditional.

  3. jessn
    Member
    Posted 4 years ago #

    Thanks, yep I got that. <?php if ( is_tag() ) { ?>

    Now I'm having a problem with the monthly archives. It's showing the months, but when I click on one it just pulls up all posts written, instead of those written in that month. It could be because I have it excluding a few categories maybe? Any idea what I'm doing wrong?

    <h2>Monthly Archive Of <?php the_time('F Y'); ?></h2>
    <?php query_posts('cat=-11,-23'); ?>
  4. MichaelH
    Member
    Posted 4 years ago #

    Can only guess this would work:

    <h2>Monthly Archive Of <?php the_time('F Y'); ?></h2>
    <?php query_posts($query_string . '&cat=-11,-23'); ?>

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags