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
1073  */
1074 function get_calendar($initial = true, $echo = true) {
1075      global $wpdb, $m, $monthnum, $year, $wp_locale, $posts;
1076
1077      $cache = array();
1078      $key = md5( $m . $monthnum . $year );
1079      if ( $cache = wp_cache_get( 'get_calendar', 'calendar' ) ) {
1080           if ( is_array($cache) && isset( $cache[ $key ] ) ) {
1081                if ( $echo ) {
1082                     echo apply_filters( 'get_calendar',  $cache[$key] );
1083                     return;
1084                } else {
1085                     return apply_filters( 'get_calendar',  $cache[$key] );
1086                }
1087           }
1088      }
1089
1090      if ( !is_array($cache) )
1091           $cache = array();
1092
1093      // Quick check. If we have no posts at all, abort!
1094      if ( !$posts ) {
 
Line Code
1260      if ( $pad != 0 && $pad != 7 )
1261           $calendar_output .= "\n\t\t".'<td class="pad" colspan="'. esc_attr($pad) .'">&nbsp;</td>';
1262
1263      $calendar_output .= "\n\t</tr>\n\t</tbody>\n\t</table>";
1264
1265      $cache[ $key ] = $calendar_output;
1266      wp_cache_set( 'get_calendar', $cache, 'calendar' );
1267
1268      if ( $echo )
1269           echo apply_filters( 'get_calendar',  $calendar_output );
1270      else
1271           return apply_filters( 'get_calendar',  $calendar_output );
1272
1273 }
1274
1275 /**
1276  * Purge the cached results of get_calendar.
1277  *
1278  * @see get_calendar
1279  * @since 2.1.0
1280  */