Advertisement
Guest User

functions child theme red highlights

a guest
Apr 17th, 2012
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.64 KB | None | 0 0
  1. <?php
  2.  
  3. /** Tell WordPress to run post_theme_setup() when the 'after_setup_theme' hook is run. */
  4. add_action( 'after_setup_theme', 'post_theme_setup' );
  5.  
  6. if ( !function_exists( 'post_theme_setup' ) ):
  7. function post_theme_setup() {
  8.  
  9. /* Add our new styles after all other stylesheets have loaded */
  10. function twentyeleven_enqueue_child_style() {
  11. wp_enqueue_style( 'child_style', get_stylesheet_directory_uri() . '/custom-style.css', array(), null );
  12. do_action( 'twentyeleven_enqueue_child_style', 'child_style' );
  13. }
  14. add_action( 'wp_enqueue_scripts', 'twentyeleven_enqueue_child_style', 11 );
  15.  
  16. /* Remove the default excerpt length for smaller blocks */
  17. remove_filter( 'excerpt_length', 'twentyeleven_excerpt_length' );
  18.  
  19. /* Change the return value for smaller blocks */
  20. function twentyeleven_child_excerpt_length( $length ) {
  21. return 20;
  22. }
  23. add_filter( 'excerpt_length', 'twentyeleven_child_excerpt_length' );
  24.  
  25. }
  26. endif;
  27.  
  28. // The height and width of your custom header. You can hook into the theme's own filters to change these values.
  29. // Add a filter to twentyten_header_image_width and twentyten_header_image_height to change these values.
  30. define( 'HEADER_IMAGE_WIDTH', apply_filters( 'twentyeleven_header_image_width', 940 ) );
  31. define( 'HEADER_IMAGE_HEIGHT', apply_filters( 'twentyeleven_header_image_height', 198 ) );
  32.  
  33. /** Page Template Sidebar Overwrite Theme Options in Twenty Eleven - change sidebar location */
  34. function twentyeleven_child_pagetemplates_body_classes( $wp_classes, $extra ){
  35.  
  36. $classes = array();
  37.  
  38. if( is_page_template( 'sidebar-left-page.php' ) ) :
  39. // correction for the Left Sidebar Template
  40. $classes[] = 'left-sidebar';
  41. $blacklist = array('right-sidebar','singular');
  42. // Filter the body classes
  43. foreach( $blacklist as $val ) {
  44. if (!in_array($val, $wp_classes)) : continue;
  45. else:
  46. foreach($wp_classes as $key => $value) {
  47. if ($value == $val) unset($wp_classes[$key]);
  48. }
  49. endif;
  50. }
  51. endif;
  52.  
  53. if( is_page_template( 'sidebar-right-page.php' ) ) :
  54. // correction for the Right Sidebar Template
  55. $classes[] = 'right-sidebar';
  56. $blacklist = array('left-sidebar','singular');
  57. // Filter the body classes
  58. foreach( $blacklist as $val ) {
  59. if (!in_array($val, $wp_classes)) : continue;
  60. else:
  61. foreach($wp_classes as $key => $value) {
  62. if ($value == $val) unset($wp_classes[$key]);
  63. }
  64. endif;
  65. }
  66. endif;
  67.  
  68. return array_merge($wp_classes, (array) $extra, $classes );
  69. }
  70.  
  71. add_filter( 'body_class', 'twentyeleven_child_pagetemplates_body_classes', 20, 2 );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement