max_num_pages > 1 ) : ?> get_stylesheet_directory_uri() . '/images/headers/2012-XTended-header.jpg', ); add_theme_support( 'custom-header', $args ); } // add it the same way Twenty Twelve does add_action( 'after_setup_theme', 'mytheme_custom_header_setup' ); // 2.3 - Tip03 - Mark main navigation menu items, containing children with special css class .dropdown // Main navigation menu items with drop-down children will be marked by a distinct icon (caret down) via style.css // http://stackoverflow.com/questions/8448978/wordpress-how-do-i-know-if-a-menu-item-has-children function menu_set_dropdown( $sorted_menu_items, $args ) { $last_top = 0; foreach ( $sorted_menu_items as $key => $obj ) { // it is a top lv item? if ( 0 == $obj->menu_item_parent ) { // set the key of the parent $last_top = $key; } else { $sorted_menu_items[$last_top]->classes['dropdown'] = 'dropdown'; } } return $sorted_menu_items; } add_filter( 'wp_nav_menu_objects', 'menu_set_dropdown', 10, 2 ); // 2.4 - Tip04 - Print HTML bellow post title with meta information for the current post date/time and author function twentytwelve_entry_meta_top() { $date = sprintf( '', esc_url( get_permalink() ), esc_attr( get_the_time() ), esc_attr( get_the_date( 'c' ) ), esc_html( get_the_date() ) ); $author = sprintf( '', esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ), esc_attr( sprintf( __( 'View all posts by %s', 'twentytwelve' ), get_the_author() ) ), get_the_author() ); // Translators: 1 is the date and 2 is the author's name $utility_text = __( '%1$s by %2$s ', 'twentytwelve' ); printf( $utility_text, $date, $author ); } // 2.5 - Tip05 - Remove junk from head remove_action('wp_head', 'rsd_link'); remove_action('wp_head', 'wp_generator'); remove_action('wp_head', 'index_rel_link'); remove_action('wp_head', 'wlwmanifest_link'); // 2.6 - Tip06 - Remove WordPress version info from head and feeds function complete_version_removal() { return ''; } add_filter('the_generator', 'complete_version_removal'); // 2.7 - Tip07 - No more jumping for read more link // Clicking on "read more" or "continue reading" sends user to the top of the post, not to the place marked with "more" function remove_more_jump_link($link) { $offset = strpos($link, '#more-'); if ($offset) { $end = strpos($link, '"',$offset); } if ($end) { $link = substr_replace($link, '', $offset, $end-$offset); } return $link; } add_filter('the_content_more_link', 'remove_more_jump_link'); // 2.8 - Tip08 - Remove curly quotes in WordPress remove_filter('the_content', 'wptexturize'); // 2.9 - Tip09 - Properly resize videos, inserted with oembed // By Marty Kokes: http://wordpress.org/support/topic/properly-resizing-videos-possible-code-addition function css_oembed_filter($html, $url, $attr, $post_ID) { $return = '
'.$html.'
'; return $return; } // 2.10 - Tip12 - Completely disable the Post Formats UI in the post editor screen // Have a normal/business website and do not really use or need Post Formats? http://www.wptavern.com/post-format-history-and-wordpress-3-6 // Uncomment next line to completely disable the Post Formats UI in the post editor screen: // add_filter( 'enable_post_format_ui', '__return_false' ); // 2.11 - Tip13 - Add Twenty Thirteen search form to WordPress nav menu, also see style.css // http://diythemes.com/thesis/rtfm/add-search-form-wp-wordpress-nav-menus/ function add_search_to_wp_menu ( $items, $args ) { if( 'primary' === $args -> theme_location ) { $items .= ''; } return $items; } add_filter('wp_nav_menu_items','add_search_to_wp_menu',10,2); // 2.12 - Default core markup for forms to output valid HTML5 function mytheme_html5_forms_setup() { add_theme_support( 'html5', array( 'search-form', 'comment-form', 'comment-list' ) ); } // add it the same way Twenty Twelve does add_action( 'after_setup_theme', 'mytheme_html5_forms_setup' ); // 3.0 - Tip10 - Custom functions and styles for the Schema.org microdata format support implementation, also see style.css // By Joshua Lyman: http://www.joshualyman.com/twenty-twelve-schema-org-child-theme/ // Github: http://github.com/jlyman/Twenty-Twelve-Schema.org-Child-Theme // 3.1 - Registers three footer widget areas function twentytwelve_extra_widgets_init() { register_sidebar( array( 'name' => __( 'Footer Widget Area', 'twentytwelve' ), 'id' => 'sidebar-4', 'description' => __( 'Found at the bottom of every page (except 404s) as the footer. Left Side.', 'twentytwelve' ), 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => __( 'Footer Area One', 'twentytwelve' ), 'id' => 'sidebar-5', 'description' => __( 'Found at the bottom of every page (except 404s) as the footer. Center.', 'twentytwelve' ), 'before_widget' => '", 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => __( 'Footer Area Two', 'twentytwelve' ), 'id' => 'sidebar-6', 'description' => __( 'Found at the bottom of every page (except 404s) as the footer. Right Side.', 'twentytwelve' ), 'before_widget' => '", 'before_title' => '

', 'after_title' => '

', ) ); } add_action( 'widgets_init', 'twentytwelve_extra_widgets_init' ); // 3.2 - Template for comments and pingbacks if ( ! function_exists( 'twentytwelve_comment' ) ) : /** * To override this walker in a child theme without modifying the comments template * simply create your own twentytwelve_comment(), and that function will be used instead * * Used as a callback by wp_list_comments() for displaying the comments. */ function twentytwelve_comment( $comment, $args, $depth ) { $GLOBALS['comment'] = $comment; switch ( $comment->comment_type ) : case 'pingback' : case 'trackback' : // Display trackbacks differently than normal comments ?>
  • id="comment-">

    ', '' ); ?>

  • id="li-comment-">
    %1$s %2$s', get_comment_author_link(), // If current post author is also comment author, make it known visually ( $comment->user_id === $post->post_author ) ? '' . __( 'Post author', 'twentytwelve' ) . '' : '' ); printf( '', esc_url( get_comment_link( $comment->comment_ID ) ), get_comment_time( 'c' ), // translators: 1: date, 2: time sprintf( __( '%1$s at %2$s', 'twentytwelve' ), get_comment_date(), get_comment_time() ) ); ?>
    comment_approved ) : ?>

    ', '

    ' ); ?>
    __( 'Reply', 'twentytwelve' ), 'after' => ' ', 'depth' => $depth, 'max_depth' => $args['max_depth'] ) ) ); ?>
    , ', 'twentytwelve' ) ); // Translators: used between list items, there is a space after the comma $tag_list = get_the_tag_list( '', __( ', ', 'twentytwelve' ) ); $date = sprintf( '', esc_url( get_permalink() ), esc_attr( get_the_time() ), esc_attr( get_the_date( 'c' ) ), esc_html( get_the_date() ) ); $author = sprintf( '', esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ), esc_attr( sprintf( __( 'View all posts by %s', 'twentytwelve' ), get_the_author() ) ), get_the_author() ); // Translators: 1 is category, 2 is tag, 3 is the date and 4 is the author's name if ( $tag_list ) { $utility_text = __( 'Posted in %1$s.', 'twentytwelve' ); /* $utility_text = __( 'Posted in %1$s and tagged %2$s on %3$s by %4$s.', 'twentytwelve' ); */ } elseif ( $categories_list ) { $utility_text = __( 'Posted in %1$s.', 'twentytwelve' ); } else { $utility_text = __( 'Posted on %3$s by %4$s.', 'twentytwelve' ); } printf( $utility_text, $categories_list, $tag_list, $date, $author ); } endif; // 3.4 - Add Schema.org author markup to comment author links if ( ! function_exists( 'twentytwelve_comment_author_hook' ) ) : function twentytwelve_comment_author_hook( $author_code ) { if (substr($author_code, 0, 2) == '