• Hello guys,

    I’m using wordpress 3.5.1 and in an exercise, the tutor talks about creating a functions.php file into the child theme like:
    twentyten
    functions.php
    blabla subfolders
    childoftwentyten
    style.css

    The goal is to change the header size, in his functions.php (the twentyten functions.php file and the functions.php in the child theme) screen:

    define('HEADER_IMAGE_WIDTH', apply_fiters('twentyten_header_image_width', 940));
    define('HEADER_IMAGE_HEIGHT', apply_filters('twentyten_header_image_height', 198));

    He takes this portion and copy paste into the functions.php child theme.

    My code is different in my wordpress (3.5.1), it is formulated this way:

    function twentyten_setup() {
    
    	//blabla stuff
    
    	// The custom header business starts here.
    
    	$custom_header_support = array(
    		// The default image to use.
    		// The %s is a placeholder for the theme template directory URI.
    		'default-image' => '%s/images/headers/path.jpg',
    		// The height and width of our custom header.
    		'width' => apply_filters( 'twentyten_header_image_width', 940 ),
    		'height' => apply_filters( 'twentyten_header_image_height', 198 ),
    		// Support flexible heights.
    		'flex-height' => true,
    		// Don't support text inside the header image.
    		'header-text' => false,
    		// Callback for styling the header preview in the admin.
    		'admin-head-callback' => 'twentyten_admin_header_style',
    	);
    
    	add_theme_support( 'custom-header', $custom_header_support );
    
    	if ( ! function_exists( 'get_custom_header' ) ) {
    		// This is all for compatibility with versions of WordPress prior to 3.4.
    		define( 'HEADER_TEXTCOLOR', '' );
    		define( 'NO_HEADER_TEXT', true );
    		define( 'HEADER_IMAGE', $custom_header_support['default-image'] );
    		define( 'HEADER_IMAGE_WIDTH', $custom_header_support['width'] );
    		define( 'HEADER_IMAGE_HEIGHT', $custom_header_support['height'] );
    		add_custom_image_header( '', $custom_header_support['admin-head-callback'] );
    		add_custom_background();
    	}
    
    	// blabla stuff again
    
    }

    What portion of code do I have to copy paste to make it clean, as it is different from the tutorial example?
    Thanks

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter clarenceperez

    (@clarenceperez)

    sorry;

    <ul>
    twentyten</ul>
    <li>functions.php</li>
    <li>blabla subfolders</li>
    <ul>
    childoftwentyten</ul>
    <li>style.css</li>
    <li>functions.php</li>


    [Bump deleted per http://codex.wordpress.org/Forum_Welcome#No_Bumping ]

    1. Have Exploring the finished Exercise File that comes with Lynda.com
    2 try to change the header size width’, 840, first check the Css to.. Child theme style & main style

    3 define(‘HEADER_IMAGE_WIDTH’,apply_fiters(‘twentyten_header_image_width’, 840));

    4. test & test & test & test ..

    Thing is, the differences in the code is due to the change in defining custom headers in WP3.4+. The code you currently have from 3.5.1 is the new (and correct) way of defining custom headers.

    This section:

    if ( ! function_exists( 'get_custom_header' ) ) {
    		// This is all for compatibility with versions of WordPress prior to 3.4.
    		define( 'HEADER_TEXTCOLOR', '' );
    		define( 'NO_HEADER_TEXT', true );
    		define( 'HEADER_IMAGE', $custom_header_support['default-image'] );
    		define( 'HEADER_IMAGE_WIDTH', $custom_header_support['width'] );
    		define( 'HEADER_IMAGE_HEIGHT', $custom_header_support['height'] );
    		add_custom_image_header( '', $custom_header_support['admin-head-callback'] );
    		add_custom_background();
    	}

    is only there for compatibility with old wordpress version less than v3.4. If you notice, this is the old way and one that the tutorials uses. but this is out dated.

    Thread Starter clarenceperez

    (@clarenceperez)

    Thank you guys, here is what is put in my functions.php file:

    $custom_header_support = array(

    'width' => apply_filters( 'twentyten_header_image_width', 980 ),
    'height' => apply_filters( 'twentyten_header_image_height', 222 )
    );

    add_theme_support( 'custom-header', $custom_header_support );

    It works! I wonder if the fact that it is not enclosed by a function can be a problem?

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Lynda.com – Build a ChildTheme’ is closed to new replies.