WordPress.org

Support

Support » Themes and Templates » HELP: Assign Custom Header to Pages in Twenty Ten v1.4

HELP: Assign Custom Header to Pages in Twenty Ten v1.4

  • Hopefully last one for this week lol

    When I was working with WP v3.2 at the beginning of last year, I remember that Twenty Ten made featured images the header of pages they were assigned to. This functionality seems to not work now in v3.4.

    I created a page called about and assigned an image that is the dimension of the header image to the featured image section on the bottom right. I clicked to make sure it was used as a featured image, however when I updated and view the page…nothing has changed.

    Is there something I have to activate or alter in WP v3.4 in order to gain this functionality back?

Viewing 15 replies - 1 through 15 (of 24 total)
  • esmi

    @esmi

    Forum Moderator

    Nope.

    @esmi

    Ok. Care to elaborate on that, or offer a workaround?

    If it was as simple as it used to be, I definitely wouldn’t be asking lol. What has changed?

    esmi

    @esmi

    Forum Moderator

    Have you checked that you are using an image of the right dimensions – 940px x 198px?

    @esmi

    I’ve actually altered functions.php so that my images are 980 x 220 as well as unlinking all related 940 x 198 images from the admin panel, so yep they are the size they need to be.

    Is that the only thing that would stop that from happening?

    I am using a custom coded theme, however it’s a child of Twenty Ten and I haven’t removed any functionality at all.

    esmi

    @esmi

    Forum Moderator

    Don’t edit the Twenty Ten theme. First create a child theme for your changes.

    @esmi are you reading my posts before responding lol?

    I said I’m creating a child theme lol.

    esmi

    @esmi

    Forum Moderator

    You don’t “alter” functions.php in a child theme. You add your custom function to the child’s functions.php file.

    @esmi

    I told you that I had created a child-theme. With that being said, you don’t think I know to create a functions.php file inside of the child-theme? I created a child-theme with all relevant files in the child theme.

    A functions.php file inside of the child-theme folder overrides the function.php in the parent theme. I’m well aware of this.

    So with that being said…what’s the next step to figuring this out?

    Ok so to clear up any confusion..

    I’m on WordPress v3.4
    I’ve created a Child-Theme from Twenty Ten v1.4
    I’ve overridden Twenty Ten’s functions.php with my own located in my child theme
    My site has a static home and blog page
    I’ve defined a new header image width and height 980px by 220px
    I’ve unregistered all of the default headers
    I’ve registered just one new default header which is the header for the home page

    However with all this…when I add a featured image to a Page, it doesn’t become the Header of that page and I’m confused as to why. Can someone please help me?

    Here’s the code to my child-themes HEADER.PHP file:

    [Code moderated as per the Forum Rules. The maximum number of lines of code that you can post in these forums is ten lines. Please use the pastebin]

    Can anyone help at all?

    I’d rather not use a plug-in if this functionality is easily added to WordPress via a couple lines of PHP.

    In my child-themes Header.PHP file I changed code located on line 71 to:

    if ( is_singular() && current_theme_supports( 'post-thumbnails' ) &&
    to
    if ( is_page() && is_singular() && current_theme_supports( 'post-thumbnails' ) &&

    Yet this is still not working. Can someone please help and tell me what I’m doing wrong?

    esmi

    @esmi

    Forum Moderator

    What’s the function you used to overwrite the header image dimensions in the child theme?

    @esmi

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

    @esmi

    Forum Moderator

    That’s in the child theme? If so, that’s what is causing your problem. You can’t DEFINE a constant more than once. Since it’s defined in the parent, you cannot re-use DEFINE in the child. You use the filters instead. so something like:

    add_filter( 'twentyten_header_image_width', 'my_header_width' );
    add_filter( 'twentyten_header_image_height', 'my_header_height' );
    function my_header_width($width) {
    	$width = 980;
    	return $width;
    }
    function my_header_height($height) {
    	$height = 220;
    	return $height;
    }

    in the child should work.

Viewing 15 replies - 1 through 15 (of 24 total)
  • The topic ‘HELP: Assign Custom Header to Pages in Twenty Ten v1.4’ is closed to new replies.