'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( __( ' by ', '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 ', 'yoko' ) . ''; } /** * 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' : ?>
  • id="li-comment-">
    comment_approved == '0' ) : ?>

    $depth, 'max_depth' => $args['max_depth'] ) ) ); ?>
    __( 'Sidebar 1', 'yoko' ), 'id' => 'sidebar-1', 'description' => __( 'Primary sidebar area', 'yoko' ), 'before_widget' => '', 'before_title' => '

    ', 'after_title' => '

    ', ) ); register_sidebar( array( 'name' => __( 'Sidebar 2', 'yoko' ), 'id' => 'sidebar-2', 'description' => __( 'An optional second sidebar area', 'yoko' ), 'before_widget' => '', 'before_title' => '

    ', 'after_title' => '

    ', ) ); } add_action( 'widgets_init', 'yoko_widgets_init' ); /** * Removes the default styles that are packaged with the Recent Comments widget. */ function yoko_remove_recent_comments_style() { global $wp_widget_factory; if ( isset( $wp_widget_factory->widgets['WP_Widget_Recent_Comments'] ) ) { remove_action( 'wp_head', array( $wp_widget_factory->widgets['WP_Widget_Recent_Comments'], 'recent_comments_style' ) ); } } add_action( 'widgets_init', 'yoko_remove_recent_comments_style' ); /** * Enqueue scripts and styles */ function yoko_scripts() { global $post; wp_enqueue_style( 'style', get_stylesheet_uri() ); wp_enqueue_style( 'yoko-fonts', "https://fonts.googleapis.com/css?family=Droid+Sans:regular,bold|Droid+Serif:regular,italic,bold,bolditalic&subset=latin" ); wp_enqueue_script( 'yoko-navigation', get_template_directory_uri() . '/js/navigation.js', array(), '20140702', true ); if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { wp_enqueue_script( 'comment-reply' ); } } add_action( 'wp_enqueue_scripts', 'yoko_scripts' ); /** * Enqueue font style for the custom header admin page. */ function yoko_admin_fonts( $hook_suffix ) { if ( 'appearance_page_custom-header' != $hook_suffix ) return; wp_enqueue_style( 'everafter-pacifico', "https://fonts.googleapis.com/css?family=Droid+Sans:regular,bold|Droid+Serif:regular,italic,bold,bolditalic&subset=latin" ); } add_action( 'admin_enqueue_scripts', 'yoko_admin_fonts' ); /** * Calls SmoothScroll in Footer */ function yoko_smoothscroll_init() { wp_enqueue_script( 'smoothscroll', get_template_directory_uri() . '/js/smoothscroll.js', array(), '0.1', true ); } add_action( 'wp_enqueue_scripts', 'yoko_smoothscroll_init' ); /** * Check for secondary sidebar */ function yoko_sidebar_class() { if ( is_active_sidebar( 'sidebar-2' ) ) : $class = 'two-sidebar'; else : $class = 'one-sidebar'; endif; echo 'class="' . $class . '"'; } /** * Filters wp_title to print a neat tag based on what is being viewed. * * @since Yoko 1.0.5 */ function yoko_wp_title( $title, $sep ) { global $page, $paged; if ( is_feed() ) return $title; // Add the blog name $title .= get_bloginfo( 'name' ); // Add the blog description for the home/front page. $site_description = get_bloginfo( 'description', 'display' ); if ( $site_description && ( is_home() || is_front_page() ) ) $title .= " $sep $site_description"; // Add a page number if necessary: if ( $paged >= 2 || $page >= 2 ) $title .= " $sep " . sprintf( __( 'Page %s', 'yoko' ), max( $paged, $page ) ); return $title; } add_filter( 'wp_title', 'yoko_wp_title', 10, 2 ); /** * Implement the Custom Header feature */ require( get_template_directory() . '/inc/custom-header.php' ); /** * Customizer additions. */ require get_template_directory() . '/inc/customizer.php'; /** * Load Jetpack compatibility file. */ require get_template_directory() . '/inc/jetpack.php';