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
1539  */
1540 function get_calendar($initial = true, $echo = true) {
1541      global $wpdb, $m, $monthnum, $year, $wp_locale, $posts;
1542
1543      $key = md5( $m . $monthnum . $year );
1544      if ( $cache = wp_cache_get( 'get_calendar', 'calendar' ) ) {
1545           if ( is_array($cache) && isset( $cache[ $key ] ) ) {
1546                if ( $echo ) {
1547                     /** This filter is documented in wp-includes/general-template.php */
1548                     echo apply_filters( 'get_calendar', $cache[$key] );
1549                     return;
1550                } else {
1551                     /** This filter is documented in wp-includes/general-template.php */
1552                     return apply_filters( 'get_calendar', $cache[$key] );
1553                }
1554           }
1555      }
1556
1557      if ( !is_array($cache) )
1558           $cache = array();
1559
1560      // Quick check. If we have no posts at all, abort!
1561      if ( !$posts ) {
 
Line Code
1734
1735      if ( $echo ) {
1736           /**
1737            * Filter the HTML calendar output.
1738            *
1739            * @since 3.0.0
1740            *
1741            * @param string $calendar_output HTML output of the calendar.
1742            */
1743           echo apply_filters( 'get_calendar', $calendar_output );
1744      } else {
1745           /** This filter is documented in wp-includes/general-template.php */
1746           return apply_filters( 'get_calendar', $calendar_output );
1747      }
1748
1749 }
1750
1751 /**
1752  * Purge the cached results of get_calendar.
1753  *
1754  * @see get_calendar
1755  * @since 2.1.0