Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /** Tell WordPress to run post_theme_setup() when the 'after_setup_theme' hook is run. */
- add_action( 'after_setup_theme', 'post_theme_setup' );
- if ( !function_exists( 'post_theme_setup' ) ):
- function post_theme_setup() {
- /* Add our new styles after all other stylesheets have loaded */
- function twentyeleven_enqueue_child_style() {
- wp_enqueue_style( 'child_style', get_stylesheet_directory_uri() . '/custom-style.css', array(), null );
- do_action( 'twentyeleven_enqueue_child_style', 'child_style' );
- }
- add_action( 'wp_enqueue_scripts', 'twentyeleven_enqueue_child_style', 11 );
- /* Remove the default excerpt length for smaller blocks */
- remove_filter( 'excerpt_length', 'twentyeleven_excerpt_length' );
- /* Change the return value for smaller blocks */
- function twentyeleven_child_excerpt_length( $length ) {
- return 20;
- }
- add_filter( 'excerpt_length', 'twentyeleven_child_excerpt_length' );
- }
- endif;
- // The height and width of your custom header. You can hook into the theme's own filters to change these values.
- // Add a filter to twentyten_header_image_width and twentyten_header_image_height to change these values.
- define( 'HEADER_IMAGE_WIDTH', apply_filters( 'twentyeleven_header_image_width', 940 ) );
- define( 'HEADER_IMAGE_HEIGHT', apply_filters( 'twentyeleven_header_image_height', 198 ) );
- /** Page Template Sidebar Overwrite Theme Options in Twenty Eleven - change sidebar location */
- function twentyeleven_child_pagetemplates_body_classes( $wp_classes, $extra ){
- $classes = array();
- if( is_page_template( 'sidebar-left-page.php' ) ) :
- // correction for the Left Sidebar Template
- $classes[] = 'left-sidebar';
- $blacklist = array('right-sidebar','singular');
- // Filter the body classes
- foreach( $blacklist as $val ) {
- if (!in_array($val, $wp_classes)) : continue;
- else:
- foreach($wp_classes as $key => $value) {
- if ($value == $val) unset($wp_classes[$key]);
- }
- endif;
- }
- endif;
- if( is_page_template( 'sidebar-right-page.php' ) ) :
- // correction for the Right Sidebar Template
- $classes[] = 'right-sidebar';
- $blacklist = array('left-sidebar','singular');
- // Filter the body classes
- foreach( $blacklist as $val ) {
- if (!in_array($val, $wp_classes)) : continue;
- else:
- foreach($wp_classes as $key => $value) {
- if ($value == $val) unset($wp_classes[$key]);
- }
- endif;
- }
- endif;
- return array_merge($wp_classes, (array) $extra, $classes );
- }
- add_filter( 'body_class', 'twentyeleven_child_pagetemplates_body_classes', 20, 2 );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement