Why max-width:97.5% on content images?

Since the TwentyEleven theme also includes some default padding and a border for (fluid) images (see CSS below), a width of 100% would push the image outside of its container’s width. This is because of how the box model works: border and padding are added to the width/height. img[class*=”align”], img[class*=”wp-image-“], #content .gallery .gallery-icon img { … Read more

How do I override template-tags.php in twentyseventeen theme

If you take a look at template-tags.php file, then you’ll see something like that: if ( ! function_exists( ‘twentyseventeen_posted_on’ ) ) : /** * Prints HTML with meta information for the current post-date/time and author. */ function twentyseventeen_posted_on() { // Get the author name; wrap it in a link. $byline = sprintf( /* translators: %s: … Read more

How to replace default rotating header images with my own

Best way to go is to make a Child Theme of Twenty Eleven. Then first remove the default images: // REMOVE TWENTY ELEVEN DEFAULT HEADER IMAGES function wptips_remove_header_images() { unregister_default_headers( array(‘wheel’,’shore’,’trolley’,’pine-cone’,’chessboard’,’lanterns’,’willow’,’hanoi’) ); } add_action( ‘after_setup_theme’, ‘wptips_remove_header_images’, 11 ); After that you can tell your Child theme to use your own images: //ADD NEW DEFAULT HEADER … Read more

Optimal approach for replacing the 8 header images in a child theme?

I am never sure about ‘optimal approach’ – however, I am using this in the functions.php in a child theme of Twenty Eleven //deregister the header images of Twenty Eleven, and register a few new RAW header images// add_action( ‘after_setup_theme’, ‘raw_theme_header_images’, 11 ); function raw_theme_header_images() { unregister_default_headers( array( ‘wheel’, ‘shore’, ‘trolley’, ‘pine-cone’, ‘chessboard’, ‘lanterns’, ‘willow’, … Read more

Why to check if function doesn’t exists in functions.php?

A child theme may have declared these functions already with a slightly different inner logic. The functions.php from the child theme is loaded before the file from the parent theme. Without this check you would get the Cannot redeclare … error. Plugins can create functions too, so this problem is not restricted to the themes … Read more

How do I add nested categories to drop-down menu in twenty-eleven?

As a purely theory example, this is how I would approach the problem: $cats = get_categories(); echo ‘<ul>’; foreach($cats as $cat) { echo'<li>’.$cat->name; if($cat->parent != 0) { $subcats = get_category(‘child_of=”.$cat->cat_ID; echo “<ul>’; foreach($subcats as $subcat){ echo ‘<li>’.$subcat->name.'</li>’; } } echo ‘</li>’; } echo ‘</ul>’; I don’t expect that to work fully as I coded it … Read more