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( '%3$s',
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' );
// 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 ) : ?>
', '' ); ?>