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
1105  */
1106 function get_calendar($initial = true, $echo = true) {
1107      global $wpdb, $m, $monthnum, $year, $wp_locale, $posts;
1108
1109      $cache = array();
1110      $key = md5( $m . $monthnum . $year );
1111      if ( $cache = wp_cache_get( 'get_calendar', 'calendar' ) ) {
1112           if ( is_array($cache) && isset( $cache[ $key ] ) ) {
1113                if ( $echo ) {
1114                     echo apply_filters( 'get_calendar',  $cache[$key] );
1115                     return;
1116                } else {
1117                     return apply_filters( 'get_calendar',  $cache[$key] );
1118                }
1119           }
1120      }
1121
1122      if ( !is_array($cache) )
1123           $cache = array();
1124
1125      // Quick check. If we have no posts at all, abort!
1126      if ( !$posts ) {
 
Line Code
1291      if ( $pad != 0 && $pad != 7 )
1292           $calendar_output .= "\n\t\t".'<td class="pad" colspan="'. esc_attr($pad) .'">&nbsp;</td>';
1293
1294      $calendar_output .= "\n\t</tr>\n\t</tbody>\n\t</table>";
1295
1296      $cache[ $key ] = $calendar_output;
1297      wp_cache_set( 'get_calendar', $cache, 'calendar' );
1298
1299      if ( $echo )
1300           echo apply_filters( 'get_calendar',  $calendar_output );
1301      else
1302           return apply_filters( 'get_calendar',  $calendar_output );
1303
1304 }
1305
1306 /**
1307  * Purge the cached results of get_calendar.
1308  *
1309  * @see get_calendar
1310  * @since 2.1.0
1311  */