WordPress.org

Codex

Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Function Reference/get calendar

Description

Displays the calendar (defaults to current month/year). Days with posts are styled as such. This tag can be used anywhere within a template.

Usage

 <?php get_calendar$initial$echo ); ?> 

Parameters

$initial
(boolean) (optional) If true, the day will be displayed using a one-letter initial; if false, an abbreviation based on your localization will be used.
Default: True
  • False - causes "Sunday" to be displayed as "Sun"
  • True - causes it to be "S"
$echo
(boolean) (optional) Determines whether or not the calendar should be displayed.
Default: True
  • False - Returns calendar, but does not echo it to screen
  • True - Echos calendar, but does not return it to a variable

Examples

Default Usage

Displays calendar highlighting any dates with posts.

<?php get_calendar(); ?>

Displays Weekday Abbrevations

Display days using one-letter initial only; in 1.5, displays initial based on your WordPress Localization.

<?php get_calendar(true); ?>

Notes

Change Log

Since: 1.0.0

Source Code

get_calendar() is located in wp-includes/general-template.php.

Related

get_calendar(), get_day_link(), get_month_link(), get_the_date(), get_the_time(), get_year_link(), single_month_title(), the_date(), the_date_xml(), the_modified_date(), get_the_modified_date(), the_modified_time(), get_the_modified_time(), the_time()

See also index of Function Reference and index of Template Tags.