'ffffff', 'text' => '777777', 'link' => '009bc2', 'border' => 'dddddd', 'url' => '009bc2' ); } /** * Set the content width based on the theme's design and stylesheet. */ if ( ! isset( $content_width ) ) $content_width = 611; /** * Set content width for full-width template */ function yoko_content_width() { global $content_width; if ( is_page_template( 'full-width-page.php' ) ) { $content_width = 1102; } } add_action( 'template_redirect', 'yoko_content_width' ); /** * Tell WordPress to run yoko() when the 'after_setup_theme' hook is run. */ if ( ! function_exists( 'yoko' ) ): /** * Sets up theme defaults and registers support for WordPress features. */ function yoko() { //Create Yoko Theme Options Page require_once ( get_template_directory() . '/inc/theme-options/theme-options.php' ); // This theme styles the visual editor with editor-style.css to match the theme style. add_editor_style(); // This theme uses post thumbnails add_theme_support( 'post-thumbnails' ); //Make theme available for translation load_theme_textdomain( 'yoko', get_template_directory() . '/languages' ); // 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', 'yoko' ), 'sub_menu' => __( 'Sub Menu', 'yoko' ) ) ); // Add support for Post Formats add_theme_support( 'post-formats', array( 'aside', 'gallery', 'link', 'video', 'image', 'quote' ) ); // This theme allows users to set a custom background add_theme_support( 'custom-background' ); } endif; add_action( 'after_setup_theme', 'yoko' ); /** * Adds custom classes to the array of body classes. */ function yoko_body_classes( $classes ) { // Adds a class of group-blog to blogs with more than 1 published author if ( is_multi_author() ) $classes[] = 'group-blog'; return $classes; } add_filter( 'body_class', 'yoko_body_classes' ); if ( ! function_exists( 'yoko_posted_on' ) ) : /** * Prints HTML with meta information for the current post-date/time and author. */ function yoko_posted_on() { printf( __( ' ', 'yoko' ), esc_url( get_permalink() ), esc_attr( get_the_time() ), esc_attr( get_the_date( 'c' ) ), esc_html( get_the_date() ), esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ), esc_attr( sprintf( __( 'View all posts by %s', 'yoko' ), get_the_author() ) ), esc_html( get_the_author() ) ); } endif; if ( ! function_exists( 'yoko_content_nav' ) ) : /** * Display navigation to next/previous pages when applicable */ function yoko_content_nav( $nav_id ) { global $wp_query; $nav_class = 'site-navigation paging-navigation'; if ( is_single() ) $nav_class = 'site-navigation post-navigation'; ?> Permalink.', 'yoko' ); } else { $meta_text = __( 'Permalink.', 'yoko' ); } } else { // But this blog has loads of categories so we should probably display them here if ( '' != $tag_list && ! is_wp_error( $tag_list ) ) { $meta_text = __( 'Categories: %1$s | Tags: %2$s | Permalink.', 'yoko' ); } else { $meta_text = __( 'Categories: %1$s | Permalink.', 'yoko' ); } } // end check for categories on this blog // If the taglist is an error, empty it before running printf if ( is_wp_error( $tag_list ) ) { $tag_list = ''; } printf( $meta_text, $category_list, $tag_list, get_permalink(), the_title_attribute( 'echo=0' ) ); } endif; /** * Returns true if a blog has more than 1 category */ function yoko_categorized_blog() { 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 = is_countable( $all_the_cool_cats ) ? count( $all_the_cool_cats ) : 0; set_transient( 'all_the_cool_cats', $all_the_cool_cats ); } if ( '1' != $all_the_cool_cats ) { // This blog has more than 1 category so yoko_categorized_blog should return true return true; } else { // This blog has only 1 category so yoko_categorized_blog should return false return false; } } /** * Flush out the transients used in yoko_categorized_blog */ function yoko_category_transient_flusher() { // Like, beat it. Dig? delete_transient( 'all_the_cool_cats' ); } add_action( 'edit_category', 'yoko_category_transient_flusher' ); add_action( 'save_post', 'yoko_category_transient_flusher' ); /** * Get our wp_nav_menu() fallback, wp_page_menu(), to show a home link. */ function yoko_page_menu_args( $args ) { $args['show_home'] = true; return $args; } add_filter( 'wp_page_menu_args', 'yoko_page_menu_args' ); /** * Sets the post excerpt length to 40 characters. */ function yoko_excerpt_length( $length ) { return 40; } add_filter( 'excerpt_length', 'yoko_excerpt_length' ); /** * Returns a "Continue Reading" link for excerpts */ function yoko_continue_reading_link() { return ' ' . __( 'Continue reading '; } /** * Replaces "[...]" (appended to automatically generated excerpts) with an ellipsis and yoko_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 yoko_auto_excerpt_more( $more ) { return ' …' . yoko_continue_reading_link(); } add_filter( 'excerpt_more', 'yoko_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 yoko_custom_excerpt_more( $output ) { if ( has_excerpt() && ! is_attachment() ) $output .= yoko_continue_reading_link(); return $output; } add_filter( 'get_the_excerpt', 'yoko_custom_excerpt_more' ); if ( ! function_exists( 'yoko_comment' ) ) : /** * Template for comments and pingbacks. */ function yoko_comment( $comment, $args, $depth ) { $GLOBALS['comment'] = $comment; switch ( $comment->comment_type ) : case 'pingback' : case 'trackback' : ?> ', 'yoko' ) . '