Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have created an archive page.. where i wanted to display which archive month is displaying.. how can I display the month name?

share|improve this question
    
Jeremy has provided a solid answer. Did his approach work for you? If so, please mark it as accepted. –  Brian Fegter Aug 31 '12 at 13:28

2 Answers 2

To display the Month, place this in your template where you want the date to show:

<?php the_date('F m'); ?>

That will show the full month name and the day. If you just want an abbreviation of the month like Aug. you would use:

<?php the_date('M.'); ?>

Place in front of <?php the_the_permalink(); ?>

Here's a complete example using it with the title:

<h2><?php the_date('M.'); ?> <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a>
share|improve this answer

If you want to get the month of the current archive page you'll have to use single_month_title. The following code will output " August 2014" (notice the space before the month)

<?php single_month_title(' ') ?>

Without a space before the month:

<?php echo trim(single_month_title(' ',false)) ?>

Read more: http://codex.wordpress.org/Function_Reference/single_month_title

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.