• Good Day,
    I am learning how to create a child theme with lynda.com.
    Unfortunatly when there is no teacher you have no one to ask question to, so you sit there and spin!

    Any ways, here is my question;
    I have created a new folder with the name of my new theme. I have placed a style.css in that folder with all of the appropriate css. (the sheet is also imported from the twent tenty theme).
    To get my header image to display to 980X224 have copied the functions.php folder from twenty ten and into my new theme folder.

    When I refresh my site eveything is great. The header image is perfect.
    My problem is this.
    I am not able to change my featured image on any of my pages. I can select a new header image in the dashboard. That image will then be displayed on all of my pages. When I go into one of my pages and set the featured image to a different image it does not work. I have been sitting here all day and am starting to go mad!
    If I remove the functions.php from the folder then I can have a differnt header image for each page but the size is messed up. If I replace the funtions.php back into the theme folder the size is perfect but I am stuck with whatever I choose as my header image for all pages.
    Some one please help!.
    Thank you in advance
    Shep

Viewing 15 replies - 1 through 15 (of 26 total)
  • have copied the functions.php folder from twenty ten and into my new theme folder.

    And that’s where you went wrong. You must start with a blank functions.php file in your child theme and then only add your amended or custom functions.

    Thread Starter shepme

    (@shepme)

    Thank for the quick reply;
    I have followed the video from Lynda.com but will not work.
    Here is what is in my function.php now. Could you advise on what I need to add or remove. I have been at this literally all day and am getting no where.
    I really appreciate your help.

    [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]

    I have placed a style.css in that folder with all of the appropriate css. (the sheet is also imported from the twent tenty theme).

    Can you also elaborate on what you mean by “imported”? You didn’t copy all of the parent’s CSS into the child, did you?

    Thread Starter shepme

    (@shepme)

    No sorry my error I have the code @import url(‘../twentyten/style.css’); at the top of my style sheet. Then below it I have all of the styles that I want to change. I don’t think that is my issue. If I drag my functions.php out of my theme folder and on to my desktop it works perfect. I could create a different image for each pages header but the size is no good. If I drag functions.php back, the size is good but I am stuck with whatever I have chosen for my header image and can not assign a featured image on each page?
    Thanks
    sShep

    OK – start with a blank functions.php file and add:

    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 = 224;
    	return $height;
    }
    Thread Starter shepme

    (@shepme)

    No Dice?

    I created a new functions.php and added the following per your instructions:

    <?php
    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 = 224;
        return $height;
    }
    ?>

    The size is good but am still unable to change header images using the featured image option?

    Shep

    Are you using images that are 980px by 224px?

    Thread Starter shepme

    (@shepme)

    Good Morning Esmi;
    First of all I want to thank you for working with me. I truly do appreciate it.
    Yes the header images that I am trying to use as a featured image on a page is 980 X 224.
    I spent another 3 or 4 hours last night trying to figure it out with no luck.
    Move the functions.php out of the themes folder and you can have a different header picture (set as featured image) on each page but the size is wrong. Put the functions.php back into the themes folder and the size is perfect but you can no longer change images. You are stuck with the single header image that you gave chosen in headers.

    What version of WordPress are you using?

    Hi,
    If you are changing the header size in a child theme then it needs to be wrapped in a ‘post_theme_setup’ function, called with the ‘after_setup_theme’ hook!

    WordPress will then load the childs functions.php, the parents functions.php and lastly the childs ‘after_setup_theme’ function hook.

    add_action( 'after_setup_theme', 'post_theme_setup' );
    if ( !function_exists( 'post_theme_setup' ) ):
    function post_theme_setup() {
       /* Code goes here! */
    }
    endif;

    The images will not be re-sized retrospectivly, the parents headers will always be smaller than the new ones, so you will upload new images.

    I will leave it back with esmi!

    HTH

    David

    Hi Shepme,

    I am having the exact same issue with my Lynda tutorial, it has stumped me and now I am stuck trying to figure out this function so I can keep on moving forward!

    Unfortunately the trainer on Lynda is using a slightly different version of the TwentyTen theme and that’s where the issue lies im guessing. So much for streamlined learning!

    Hoping to see a resolution shortly.

    Try this, my function with the one from esmi inside

    <?php
    
    /* This function will run after the parents functions.php */
    add_action( 'after_setup_theme', 'post_theme_setup' );
    
    if ( !function_exists( 'post_theme_setup' ) ):
    
    function post_theme_setup() {
       /* Code goes here! */
    
       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 = 224;
    	return $height;
       }
    }
    
    endif;

    HTH

    David

    Thread Starter shepme

    (@shepme)

    Hi David;
    Thanks for the input. I will try what you have suggested.
    Can you please advise exactly were I place this inside of the header.php.
    Thanks
    Shepard

    Thread Starter shepme

    (@shepme)

    Good Day, Muchogaucho:
    Yes, I have found the same thing with the “creating child themes” using Lynda.com. Many of the steps Morten (the instructor) shows the viewer to do on a php document is different than the actual php document that you open so it is a bit confusing were to place certain things. It take a couple of tries.
    I have been designing websites for the past 2 or 3 years and have always wanted to learn how to create sites in wordpress that the person whom you are building it for could go in and alter the pages without getting into the html/css.
    I was disappointed to learn that to customize wordpress you have to know PHP. I thought there would be a css page and an html page for each page and you build it using those two things with maybe some Javascript thrown in.
    It appears if I want to pursue the wordpress thing I must first learn PHP.
    What are your feelings?
    Shep

    Can you please advise exactly were I place this inside of the header.php.

    @sheme and @muchogaucho
    If you have been adding this code in the header.php then you are off track, the code goes in the child theme, if you do not have a functions.php then you must create one and add the code!

    It could be your lucky day, I posted a Video on YouTube yesterday that does most of what you want it adjusts the header height, removed the default headers,however adjusting the width means also adjusting the styles.css

    Here is the YouTube Video

    There is a whole series of posts (Over 20 Sessions) on my website for beginners, with the twenty ten theme, these are now old but they might help you get a base understanding!

    The posts have download child themes, there is also a downloads page, and it is all free!

    Please do watch the Video and take in the instruction, that is the way you will learn, rather than just downloading the child themes.

    HTH

    David

Viewing 15 replies - 1 through 15 (of 26 total)
  • The topic ‘twenty ten child theme’ is closed to new replies.