Skip to content

Instantly share code, notes, and snippets.

@ashblue
Created August 18, 2011 15:48
Show Gist options
  • Save ashblue/1154369 to your computer and use it in GitHub Desktop.
Save ashblue/1154369 to your computer and use it in GitHub Desktop.
WordPress TwentyEleven Child Theme Shiv
<?php
/*
Title: TwentyEleven Child Theme Shiv
Version: .02
Author: Ash Blue
Author URL: http://www.blueashes.com
Repository URL: https://gist.github.com/gists/1154369/
*/
/************
Calls / Hooks
************/
add_filter('the_content_more_link', 'remove_more_jump_link');
add_action('after_setup_theme', 'my_child_theme_setup', 11);
/************
WordPress Core Hacks
************/
// Stop read more from following a bookmark and jumping down the page
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;
}
/************
TwentyEleven Reset
************/
function my_child_theme_setup() {
// Set default editor width
$content_width = 620;
// Set new thumbnail size
set_post_thumbnail_size(460, 220, true);
// Remove sidebar
remove_filter( 'widgets_init', 'twentyeleven_widgets_init' );
// Remove menu registration
unregister_nav_menu('primary');
// Setup post formats
remove_theme_support('post-formats');
add_theme_support( 'post-formats', array( 'aside', 'link', 'gallery', 'status', 'quote', 'image', 'video' ) ); // Add new post formats here
// Remove features and extra settings
remove_action('admin_menu', array(&$GLOBALS['custom_background'], 'init')); // Remove background options
remove_custom_image_header(); // Remove header options
remove_action( 'admin_menu', 'twentyeleven_theme_options_add_page' ); // Remove theme options
}
// Remove default header images
function wp_remove_header_images() {
unregister_default_headers( array('wheel','shore','trolley','pine-cone','chessboard','lanterns','willow','hanoi'));
}
add_action( 'after_setup_theme', 'wp_remove_header_images', 11 );
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment