• okasu

    (@okasu)


    Hey,

    I wanted to know if there is any way to display the archive title automatically, kind of like you do with post titles and such.

    Help please…

Viewing 5 replies - 1 through 5 (of 5 total)
  • esmi

    (@esmi)

    Display the archive title where? In the meta-title or the page content area?

    Thread Starter okasu

    (@okasu)

    Page content area. I’m actually trying to include it in the header of my page when people go into the monthly archive. So I just want it to say the title of that archive (march 2010 or what ever).

    Thread Starter okasu

    (@okasu)

    I use this to get the titles of my regular posts to display in my singles page header.. is it similar to do it for the archives?
    <?php the_title(); ?>

    esmi

    (@esmi)

    No – you need to use something like:

    <?php $post = $posts[0]; // Hack. Set $post so that the_date() works. ?>
    <h2 class="pagetitle">Archive for <?php the_time('F jS, Y'); ?></h2>
    <?php /* If this is a monthly archive */ } elseif (is_month()) { ?>
    <h2 class="pagetitle">Archive for <?php the_time('F, Y'); ?></h2>
    <?php /* If this is a yearly archive */ } elseif (is_year()) { ?>
    <h2 class="pagetitle">Archive for <?php the_time('Y'); ?></h2>

    which is taken straight from the archive.php template in the default theme.

    Thread Starter okasu

    (@okasu)

    This actually does the trick but I want it displayed as text only, not a link. Also, for some reason it has a bullet point in front of it. Can anyone help me out?

    <?php wp_get_archives( $args ); ?>

    I just need the archive title by month and year (ex. march 2010) to appear once you goto that specific archive from a drop down menu.

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Displaying Archive title’ is closed to new replies.