Grow your CSS skills. Land your dream job.

WordPress twenty Ten Child-Theme Custom Page Headers

  • # June 20, 2012 at 1:20 pm

    Hey how’s it going guys?

    I seem to be getting a lot of greif over on the wp.org forums, so my next try was here lol. I’m running WP v3.4 and I’ve created a Child-Theme based off of Twenty Ten v1.4. Everything is looking exactly how the client wants it except for one thing. The custom headers per page.

    Back when using Wp v3.2 I remember being able to assign a “Featured Image” to a page, and that image (if it had the correct dimensions) would become the new header for THAT page. But for some reason this is not happening in v3.4. It claims the image is featured, however no changes take place.

    As far as my child-theme goes, I’ve made both my home page and blog page static in the WP admin options. The theme I’ve constructed also has overrides for the following files from the parent theme:
    Photobucket

    And here’s my child-themes Functions.php overrides:

    < ?php

    define( 'HEADER_IMAGE_WIDTH', apply_filters( 'twentyten_header_image_width', 980 ) );
    define( 'HEADER_IMAGE_HEIGHT', apply_filters( 'twentyten_header_image_height', 220 ) );

    function remove_twentyTen_headers() {
    unregister_default_headers( array(
    'berries',
    'cherryblossom',
    'concave',
    'fern',
    'forestfloor',
    'inkwell',
    'path',
    'sunset'
    ));
    }

    add_action('after_setup_theme', 'remove_twentyTen_headers', 11);

    register_default_headers(
    array(
    'Home' => array(
    'url' => "%s/../mollyme/images/mmb-header-home.png",
    'thumbnail_url' => "%s/../mollyme/images/mmb-header-homeThumb.png",
    /* translators: header image description */
    'description' => __( 'MMB Home Header', 'twentyten' )
    )
    // 'About' => array(
    // 'url' => "%s/../mollyme/images/mmb-header-about.png",
    // 'thumbnail_url' => "%s/../mollyme/images/mmb-header-about.png",
    // /* translators: header image description */
    // 'description' => __( 'MMB About Header', 'twentyten' )
    // ),
    // 'Menu' => array(
    // 'url' => "%s/../mollyme/images/mmb-header-menu.png",
    // 'thumbnail_url' => "%s/../mollyme/images/mmb-header-menu.png",
    // /* translators: header image description */
    // 'description' => __( 'MMB Menu Header', 'twentyten' )
    // ),
    // 'Order' => array(
    // 'url' => "%s/../mollyme/images/mmb-header-order.png",
    // 'thumbnail_url' => "%s/../mollyme/images/mmb-header-order.png",
    // /* translators: header image description */
    // 'description' => __( 'MMB Order Header', 'twentyten' )
    // ),
    // 'Catering' => array(
    // 'url' => "%s/../mollyme/images/mmb-header-catering.png",
    // 'thumbnail_url' => "%s/../mollyme/images/mmb-header-catering.png",
    // /* translators: header image description */
    // 'description' => __( 'MMB Catering Header', 'twentyten' )
    // ),
    // 'Blog' => array(
    // 'url' => "%s/../mollyme/images/mmb-header-blog.png",
    // 'thumbnail_url' => "%s/../mollyme/images/mmb-header-blog.png",
    // /* translators: header image description */
    // 'description' => __( 'MMB Blog Header', 'twentyten' )
    // ),
    // 'Conact' => array(
    // 'url' => "%s/../mollyme/images/mmb-header-contact.png",
    // 'thumbnail_url' => "%s/../mollyme/images/mmb-header-contact.png",
    // /* translators: header image description */
    // 'description' => __( 'MMB Contact Header', 'twentyten' )
    // )
    )
    );

    // This theme uses wp_nav_menu() in one location.
    register_nav_menus( array(
    'header' => __( 'Header Navigation', 'twentyten' ),
    'footer' => __( 'Footer Navigation', 'twentyten' ),
    ) );

    function mmb_remove_default_menu() {
    unregister_nav_menu('primary');
    }

    add_action('after_setup_theme','mmb_remove_default_menu',11);

    function mmb_remove_widgets(){

    unregister_sidebar( 'fourth-footer-widget-area' );
    }

    add_action( 'widgets_init', 'mmb_remove_widgets', 11 );

    // Register new widgetized areas
    function mmb_widgets_init() {

    // Area 1a, below Area 1 to the left.
    register_sidebar( array(
    'name' => __( 'Left Widget Area', 'twentyten' ),
    'id' => 'left-widget-area',
    'description' => __( 'Left widget area', 'twentyten' ),
    'before_widget' => '
  • ',
    'after_widget' => '
  • ',
    'before_title' => '

    ',
    'after_title' => '

    ',
    ) );

    // Area 1b, below Area 1 to the right.
    register_sidebar( array(
    'name' => __( 'Right Widget Area', 'twentyten' ),
    'id' => 'right-widget-area',
    'description' => __( 'Right widget area', 'twentyten' ),
    'before_widget' => '
  • ',
    'after_widget' => '
  • ',
    'before_title' => '

    ',
    'after_title' => '

    ',
    ) );
    }
    /** Register sidebars by running twentyten_widgets_init() on the widgets_init hook. */
    add_action( 'widgets_init', 'mmb_widgets_init' );
    ?>

    This is something that I would seriously like to do without the use of a plug-in. Can someone please help me to understand why my featured page images aren’t showing as custom headers?

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".