WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Header Image Size - TwentyEleven (4 posts)

  1. playing2012
    Member
    Posted 1 year ago #

    How do I ensure that the image I upload is exactly 1000px x 180px and not the default of 2011 theme that is 1000px x 288px? I want to create an exact size so that it is not cropped or resised to some arbitrary figure.

    I have just set up a new site but the image is pretty big for what I want to do. Have a look here:

    <http://mytechhelp.site90.com/>

    It is still at an embryonic stage so please don't laugh!!

  2. Marventus
    Member
    Posted 1 year ago #

    Hi.
    If you are using TwentyEleven, I'm pretty sure there is a hook to set the size of your header images. Don't remember the name right now, and I have one foot out the door, but if you give me a few hours I'll look it up for you.
    Cheers!

  3. anneschmidt
    Member
    Posted 1 year ago #

    Hi -
    There is a helpful tutorial at the link below on how to do this.

    http://www.blog.web6.org/twenty-eleven-header-image-how-to-change-size/

  4. playing2012
    Member
    Posted 1 year ago #

    Thanks for the replies. I went to the tutorial but it is for the old version. However, it gave me the idea and I inserted this function in my child-theme functions.php and it works:

    <?php
    
    function add_theme_support($support_type)
    {
        $result = 0;
        return $result;
    }
    
    function apply_filters()
    {
        $result = 0;
        return $result;
    }
    
    // This theme uses Featured Images (also known as post thumbnails) for
    per-post/per-page Custom Header images
    add_theme_support('post-thumbnails');
    
    // Add support for custom headers.
    $custom_header_support = array(
        'default-text-color' => '000',
        'width' => apply_filters( 'twentyeleven_header_image_width', 1000) ,
        'height' => apply_filters( 'twentyeleven_header_image_height', 133 ),
        'flex-height' => true,
        'random-default' => true,
        'wp-head-callback' => 'twentyeleven_header_style',
        'admin-head-callback' => 'twentyeleven_admin_header_style',
        'admin-preview-callback' => 'twentyeleven_admin_header_image',
    );
    
    echo "
    <pre>";
    print_r($custom_header_support);
    echo "</pre>
    ";
    
    ?>

    Please follow this guide when posting code - I've fixed what I can, but the forum may have eaten some of your code.

Topic Closed

This topic has been closed to new replies.

About this Topic