* add_action( 'after_setup_theme', 'my_child_theme_setup' );
* function my_child_theme_setup() {
* // We are providing our own filter for excerpt_length (or using the unfiltered value)
* remove_filter( 'excerpt_length', 'vanillabloom_excerpt_length' );
* ...
* }
*
*
* For more information on hooks, actions, and filters, see http://codex.wordpress.org/Plugin_API.
*
* @package WordPress
* @subpackage Vanilla Bloom
* @since Vanilla Bloom 1.0
*/
/**
* Set the content width based on the theme's design and stylesheet.
*
* Used to set the width of images and content. Should be equal to the width the theme
* is designed for, generally via the style.css stylesheet.
*/
if ( ! isset( $content_width ) )
$content_width = 730;
/** Tell WordPress to run vanillabloom_setup() when the 'after_setup_theme' hook is run. */
add_action( 'after_setup_theme', 'vanillabloom_setup' );
if ( ! function_exists( 'vanillabloom_setup' ) ):
/**
* Sets up theme defaults and registers support for various WordPress features.
*
* Note that this function is hooked into the after_setup_theme hook, which runs
* before the init hook. The init hook is too late for some features, such as indicating
* support post thumbnails.
*
* To override vanillabloom_setup() in a child theme, add your own vanillabloom_setup to your child theme's
* functions.php file.
*
* @uses add_theme_support() To add support for post thumbnails and automatic feed links.
* @uses register_nav_menus() To add support for navigation menus.
*
* @since Vanilla Bloom 1.0
*/
function vanillabloom_setup() {
// Post Format support. You can also use the legacy "gallery" or "asides" (note the plural) categories.
add_theme_support( 'post-formats', array( 'aside', 'gallery' ) );
// This theme uses post thumbnails
add_theme_support( 'post-thumbnails' );
// Add default posts and comments RSS feed links to head
add_theme_support( 'automatic-feed-links' );
// This theme uses wp_nav_menu() in one location.
register_nav_menus( array(
'primary' => __( 'Primary Navigation', 'vanillabloom' ),
) );
}
endif;
/**
* Get our wp_nav_menu() fallback, wp_page_menu(), to show a home link.
*
* To override this in a child theme, remove the filter and optionally add
* your own function tied to the wp_page_menu_args filter hook.
*
* @since Vanilla Bloom 1.0
*/
function vanillabloom_page_menu_args( $args ) {
$args['show_home'] = true;
return $args;
}
add_filter( 'wp_page_menu_args', 'vanillabloom_page_menu_args' );
/**
* Sets the post excerpt length to 40 characters.
*
* To override this length in a child theme, remove the filter and add your own
* function tied to the excerpt_length filter hook.
*
* @since Vanilla Bloom 1.0
* @return int
*/
function vanillabloom_excerpt_length( $length ) {
return 50;
}
add_filter( 'excerpt_length', 'vanillabloom_excerpt_length' );
/**
* Returns a "Continue Reading" link for excerpts
*
* @since Vanilla Bloom 1.0
* @return string "Continue Reading" link
*/
function vanillabloom_continue_reading_link() {
return ' ' . __( 'Continue reading →', 'vanillabloom' ) . '';
}
/**
* Replaces "[...]" (appended to automatically generated excerpts) with an ellipsis and vanillabloom_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.
*
* @since Vanilla Bloom 1.0
* @return string An ellipsis
*/
function vanillabloom_auto_excerpt_more( $more ) {
return '…';
}
add_filter( 'excerpt_more', 'vanillabloom_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.
*
* @since Vanilla Bloom 1.0
* @return string Excerpt with a pretty "Continue Reading" link
*/
function vanillabloom_custom_excerpt_more( $output ) {
if ( has_excerpt() && ! is_attachment() ) {
$output .= vanillabloom_continue_reading_link();
}
return $output;
}
add_filter( 'get_the_excerpt', 'vanillabloom_custom_excerpt_more' );
if ( ! function_exists( 'vanillabloom_comment' ) ) :
/**
* Template for comments and pingbacks.
*
* To override this walker in a child theme without modifying the comments template
* simply create your own vanillabloom_comment(), and that function will be used instead.
*
* Used as a callback by wp_list_comments() for displaying the comments.
*
* @since Vanilla Bloom 1.0
*/
function vanillabloom_comment( $comment, $args, $depth ) {
$GLOBALS['comment'] = $comment;
switch ( $comment->comment_type ) :
case '' :
?>