Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: get_calendar

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

This hook occurs 4 times in this file.

Line Code
1611  */
1612 function get_calendar($initial = true, $echo = true) {
1613      global $wpdb, $m, $monthnum, $year, $wp_locale, $posts;
1614
1615      $key = md5( $m . $monthnum . $year );
1616      if ( $cache = wp_cache_get( 'get_calendar', 'calendar' ) ) {
1617           if ( is_array($cache) && isset( $cache[ $key ] ) ) {
1618                if ( $echo ) {
1619                     /** This filter is documented in wp-includes/general-template.php */
1620                     echo apply_filters( 'get_calendar', $cache[$key] );
1621                     return;
1622                } else {
1623                     /** This filter is documented in wp-includes/general-template.php */
1624                     return apply_filters( 'get_calendar', $cache[$key] );
1625                }
1626           }
1627      }
1628
1629      if ( !is_array($cache) )
1630           $cache = array();
1631
1632      // Quick check. If we have no posts at all, abort!
1633      if ( !$posts ) {
 
Line Code
1806
1807      if ( $echo ) {
1808           /**
1809            * Filter the HTML calendar output.
1810            *
1811            * @since 3.0.0
1812            *
1813            * @param string $calendar_output HTML output of the calendar.
1814            */
1815           echo apply_filters( 'get_calendar', $calendar_output );
1816      } else {
1817           /** This filter is documented in wp-includes/general-template.php */
1818           return apply_filters( 'get_calendar', $calendar_output );
1819      }
1820
1821 }
1822
1823 /**
1824  * Purge the cached results of get_calendar.
1825  *
1826  * @see get_calendar
1827  * @since 2.1.0