. add_theme_support( 'automatic-feed-links' ); // This theme uses Featured Images add_theme_support( 'post-thumbnails' ); // Add support for custom backgrounds add_theme_support( 'custom-background' ); // Set thumbnail size. set_post_thumbnail_size( 210 ); // Add a custom featured image size. add_image_size( 'homepage-thumb', 210 ); // This theme uses Custom menu in two locations register_nav_menus( array( 'primary' => __( 'Primary Navigation', 'imbalance2' ), 'secondary' => __( 'Secondary Navigation', 'imbalance2' ) ) ); add_theme_support( 'print-style' ); } endif; add_action( 'after_setup_theme', 'imbalance2_setup' ); // Background style for front-end. function imbalance2_custom_background() { if ( '' != get_background_color() && '' == get_background_image() ) : ?> ( 'rtl' == get_option( 'text_direction' ) ) ? 1 : 0, 'color' => esc_html( $color ), 'search' => __( 'Search', 'imbalance2' ), ) ); } } add_action( 'wp_enqueue_scripts', 'imbalance2_scripts' ); // Register widgetized area and update sidebar with default widgets function imbalance2_widgets_init() { register_sidebar( array( 'name' => __( 'Header Area', 'imbalance2' ), 'id' => 'sidebar-1', 'before_widget' => '
', 'after_widget' => "
", 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => __( 'Footer Area One', 'imbalance2' ), 'id' => 'sidebar-2', 'before_widget' => '
', 'after_widget' => "
", 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => __( 'Footer Area Two', 'imbalance2' ), 'id' => 'sidebar-3', 'before_widget' => '
', 'after_widget' => "
", 'before_title' => '

', 'after_title' => '

', ) ); } add_action( 'widgets_init', 'imbalance2_widgets_init' ); // Sets the post excerpt length to 40 characters. function imbalance2_excerpt_length( $length ) { return 40; } add_filter( 'excerpt_length', 'imbalance2_excerpt_length' ); // Replaces "[...]" (appended to automatically generated excerpts). function imbalance2_auto_excerpt_more( $more ) { return ''; } add_filter( 'excerpt_more', 'imbalance2_auto_excerpt_more' ); // Template for comments and pingbacks. function imbalance2_comment( $comment, $args, $depth ) { $GLOBALS['comment'] = $comment; switch ( $comment->comment_type ) : case 'pingback' : case 'trackback' : ?>
  • id="li-comment-">
    comment_approved == '0' ) : ?>
    %s', get_comment_author_link() ) ); ?>
    $depth, 'max_depth' => $args['max_depth'] ) ) ); ?>
    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 toolbox_categorized_blog should return true return true; } else { // This blog has only 1 category so toolbox_categorized_blog should return false return false; } } // Prints HTML with meta information for the current author function imbalance2_posted_by() { printf( __( 'By ', 'imbalance2' ), esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ), esc_attr( sprintf( __( 'View all posts by %s', 'imbalance2' ), get_the_author() ) ), esc_html( get_the_author() ) ); } // Prints HTML with meta information for the post date function imbalance2_posted_on() { printf( __( ' / ', 'imbalance2' ), esc_url( get_permalink() ), esc_attr( get_the_time() ), esc_attr( get_the_date( 'c' ) ), esc_html( get_the_date() ) ); } // Prints HTML with meta information for the current catgory function imbalance2_posted_in() { if ( is_object_in_taxonomy( get_post_type(), 'category' ) ) { $posted_in = __( ' / %1$s', 'imbalance2' ); } else { $posted_in = __( ' / Bookmark the permalink.', 'imbalance2' ); } printf( $posted_in, get_the_category_list( ', ' ), get_permalink(), the_title_attribute( 'echo=0' ) ); } // Prints HTML with meta information for the current tag function imbalance2_tags() { /* translators: used between list items, there is a space after the comma */ the_tags( sprintf( '
    %s ', esc_html__( 'Tags:', 'imbalance2' ) ), esc_html__( ', ', 'imbalance2' ), '
    ' ); } // Set a default theme color array for WP.com. $themecolors = array( 'bg' => 'ffffff', 'border' => 'dedfe0', 'text' => '333333', 'link' => 'f05133', 'url' => 'f05133', ); /** * Implement the Custom Header feature */ require( get_template_directory() . '/inc/custom-header.php' ); /** * Filters wp_title to print a neat tag based on what is being viewed. * * @since Imbalance 2 1.0.3 */ function imbalance2_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', 'imbalance2' ), max( $paged, $page ) ); return $title; } add_filter( 'wp_title', 'imbalance2_wp_title', 10, 2 ); /** * Load Jetpack compatibility file. */ require( get_template_directory() . '/inc/jetpack.compat.php' ); /** * Show a nice admin message saying Imbalance has an update in the form of Rebalance. */ function imbalance2_change_notice() { $theme_link = admin_url( 'themes.php?s=rebalance' ); ?> <div class="updated"> <p style="line-height: 1.5em;">Howdy! Your current theme, <em>Imbalance</em>, has seen an update in the form of a brand new theme, <a href="<?php echo $theme_link; ?>">Rebalance</a>. For more information, check out <a href="https://en.blog.wordpress.com/2016/05/19/rebalance/">our blog post introducing Rebalance to the world</a>.</p> </div> <?php } remove_action( 'admin_notices', 'show_tip' ); add_action( 'admin_notices', 'imbalance2_change_notice' );