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
1387 function get_calendar($initial = true, $echo = true) {
1388      global $wpdb, $m, $monthnum, $year, $wp_locale, $posts;
1389
1390      $cache = array();
1391      $key = md5( $m . $monthnum . $year );
1392      if ( $cache = wp_cache_get( 'get_calendar', 'calendar' ) ) {
1393           if ( is_array($cache) && isset( $cache[ $key ] ) ) {
1394                if ( $echo ) {
1395                     /** This filter is documented in wp-includes/general-template.php */
1396                     echo apply_filters( 'get_calendar', $cache[$key] );
1397                     return;
1398                } else {
1399                     /** This filter is documented in wp-includes/general-template.php */
1400                     return apply_filters( 'get_calendar', $cache[$key] );
1401                }
1402           }
1403      }
1404
1405      if ( !is_array($cache) )
1406           $cache = array();
1407
1408      // Quick check. If we have no posts at all, abort!
1409      if ( !$posts ) {
 
Line Code
1582
1583      if ( $echo ) {
1584           /**
1585            * Filter the HTML calendar output.
1586            *
1587            * @since 3.0.0
1588            *
1589            * @param string $calendar_output HTML output of the calendar.
1590            */
1591           echo apply_filters( 'get_calendar', $calendar_output );
1592      } else {
1593           /** This filter is documented in wp-includes/general-template.php */
1594           return apply_filters( 'get_calendar', $calendar_output );
1595      }
1596
1597 }
1598
1599 /**
1600  * Purge the cached results of get_calendar.
1601  *
1602  * @see get_calendar
1603  * @since 2.1.0