• C W (VYSO)

    (@cyril-washbrook)


    I’m creating my own archive.php for a theme and would like to have as the page heading “Articles from December 2011” or “Articles from 2010” etc.

    In the Twenty Eleven theme, it’s produced via:

    <?php if ( is_day() ) : ?>
    	<?php printf( __( 'Daily Archives: %s', 'twentyeleven' ), '<span>' . get_the_date() . '</span>' ); ?>
    	<?php elseif ( is_month() ) : ?>
    	<?php printf( __( 'Monthly Archives: %s', 'twentyeleven' ), '<span>' . get_the_date( _x( 'F Y', 'monthly archives date format', 'twentyeleven' ) ) . '</span>' ); ?>
    	<?php elseif ( is_year() ) : ?>
    	<?php printf( __( 'Yearly Archives: %s', 'twentyeleven' ), '<span>' . get_the_date( _x( 'Y', 'yearly archives date format', 'twentyeleven' ) ) . '</span>' ); ?>
    	<?php else : ?>
    	<?php _e( 'Blog Archives', 'twentyeleven' ); ?>
    	<?php endif; ?>

    … but I can’t seem to reproduce this in my own theme: it comes out every time as “May 2012” or “2012” regardless of which archive I’m pulling (i.e. the current date instead of the date of the archive itself). How would I produce this properly?

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Return month/year on archive pages’ is closed to new replies.