__( 'Main Menu', 'esquire' ), ) ); // Add post thumbnail support for audio album art add_theme_support( 'post-thumbnails' ); add_image_size( 'audio', 207, 207, false ); /** * Enable Post Formats */ add_theme_support( 'post-formats', array( 'aside', 'gallery', 'image', 'quote', 'link', 'audio', 'video' ) ); /** * Load Jetpack compatibility file. */ require( get_template_directory() . '/inc/jetpack.compat.php' ); /** * Load up our functions for grabbing content from posts */ require( get_template_directory() . '/content-grabbers.php' ); } add_action( 'after_setup_theme', 'esquire_setup' ); /** * Sniff out the number of categories in use and return the number of categories */ function esquire_category_counter() { if ( false === ( $all_the_cool_cats = get_transient( 'all_the_cool_cats' ) ) ) { // Create an array of all the categories that are attached to posts $all_the_cool_cats = get_categories( array( 'hide_empty' => 1, ) ); // Count the number of categories that are attached to the posts $all_the_cool_cats = count( $all_the_cool_cats ); set_transient( 'all_the_cool_cats', $all_the_cool_cats ); } return $all_the_cool_cats; } /** * Flush out the transients used in esquire_category_counter */ function esquire_category_transient_flusher() { // Like, beat it. Dig? delete_transient( 'all_the_cool_cats' ); } add_action( 'edit_category', 'esquire_category_transient_flusher' ); add_action( 'save_post', 'esquire_category_transient_flusher' ); /** * Add a class to the Older Posts link */ function esquire_next_posts_link_attributes( $attr ) { $attr = 'rel="prev"'; return $attr; } add_filter( 'next_posts_link_attributes', 'esquire_next_posts_link_attributes' ); /** * Add a class to the Newer Posts link */ function esquire_previous_posts_link_attributes( $attr ) { $attr = 'rel="next"'; return $attr; } add_filter( 'previous_posts_link_attributes', 'esquire_previous_posts_link_attributes' ); /** * Sets the post excerpt length to 40 words. * * To override this length in a child theme, remove the filter and add your own * function tied to the excerpt_length filter hook. */ function esquire_excerpt_length( $length ) { return 40; } add_filter( 'excerpt_length', 'esquire_excerpt_length' ); /** * Returns a "Continue Reading" link for excerpts */ function esquire_continue_reading_link() { return ' ' .__( 'Continue reading ', 'esquire' ) . ''; } /** * Replaces "[...]" (appended to automatically generated excerpts) with an ellipsis and esquire_continue_reading_link(). * * To override this in a child theme, remove the filter and add your own * function tied to the excerpt_more filter hook. */ function esquire_auto_excerpt_more( $more ) { return ' …' . esquire_continue_reading_link(); } add_filter( 'excerpt_more', 'esquire_auto_excerpt_more' ); /** * Adds a pretty "Continue Reading" link to custom post excerpts. * * To override this link in a child theme, remove the filter and add your own * function tied to the get_the_excerpt filter hook. */ function esquire_custom_excerpt_more( $output ) { if ( has_excerpt() && ! is_attachment() ) { $output .= esquire_continue_reading_link(); } return $output; } add_filter( 'get_the_excerpt', 'esquire_custom_excerpt_more' ); /** * Register our footer widget area * * @since Esquire 1.0 */ function esquire_widgets_init() { register_sidebar( array( 'name' => __( 'Footer', 'esquire' ), 'id' => 'sidebar-1', 'before_widget' => '", 'before_title' => '
', '' ); ?>