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
1131  */
1132 function get_calendar($initial = true, $echo = true) {
1133      global $wpdb, $m, $monthnum, $year, $wp_locale, $posts;
1134
1135      $cache = array();
1136      $key = md5( $m . $monthnum . $year );
1137      if ( $cache = wp_cache_get( 'get_calendar', 'calendar' ) ) {
1138           if ( is_array($cache) && isset( $cache[ $key ] ) ) {
1139                if ( $echo ) {
1140                     echo apply_filters( 'get_calendar',  $cache[$key] );
1141                     return;
1142                } else {
1143                     return apply_filters( 'get_calendar',  $cache[$key] );
1144                }
1145           }
1146      }
1147
1148      if ( !is_array($cache) )
1149           $cache = array();
1150
1151      // Quick check. If we have no posts at all, abort!
1152      if ( !$posts ) {
 
Line Code
1318      if ( $pad != 0 && $pad != 7 )
1319           $calendar_output .= "\n\t\t".'<td class="pad" colspan="'. esc_attr($pad) .'">&nbsp;</td>';
1320
1321      $calendar_output .= "\n\t</tr>\n\t</tbody>\n\t</table>";
1322
1323      $cache[ $key ] = $calendar_output;
1324      wp_cache_set( 'get_calendar', $cache, 'calendar' );
1325
1326      if ( $echo )
1327           echo apply_filters( 'get_calendar',  $calendar_output );
1328      else
1329           return apply_filters( 'get_calendar',  $calendar_output );
1330
1331 }
1332
1333 /**
1334  * Purge the cached results of get_calendar.
1335  *
1336  * @see get_calendar
1337  * @since 2.1.0
1338  */