WordPress.org

Forums

Twenty Twelve Header size reduction (18 posts)

  1. ian277
    Member
    Posted 2 years ago #

    Hey all,

    I've got a twenty twelve child theme and thanks to Alchymyth, I've moved the menu to below the header, but it's still huge and would like to reduce it's height and maybe reduce the padding of the header. Any advice on how to do that? I've looked around and I've only seen stuff pertaining to the twenty eleven theme.

    http://www.heavybrunch.com

    Thanks!

  2. Aaron
    Member
    Posted 2 years ago #

    Are you referring to the logo? If so that is a picture as you can see below.

    http://www.heavybrunch.com/wp-content/uploads/2012/11/heavy-Brunch.png

    To make it smaller the best way is to make a new image to the size you want it.

  3. ian277
    Member
    Posted 2 years ago #

    No, sorry. I could have been more specific.

    The header size is 950x260, and I want to reduce the header height to maybe 150px, and reduce the padding above it to keep it closer to the top of the page.

    I just quickly made a png of the dimensions specified by the header.

    Any thoughts?

  4. alchymyth
    Forum Moderator
    Posted 2 years ago #

    although you seem to have fixed it already, here is a way to change the header image dimensions:

    in functions.php of the child theme, add:

    function twentytwelvechild_custom_header_setup() {
    	$header_args = array( 'height' => 150, 'width' => 950 );
    	add_theme_support( 'custom-header', $header_args );
    }
    add_action( 'after_setup_theme', 'twentytwelvechild_custom_header_setup' );

    the padding comes from:

    /* Header */
    .site-header {
    	padding: 24px 0;
    	padding: 1.714285714rem 0;
    }
  5. ian277
    Member
    Posted 2 years ago #

    Nice, thanks for this.

    I initially just reduced the header image size in photoshop and uploaded it with the 150px height dimensions. I just copied your functions code and uploaded that and it looks great, but the header change shows on the home page and not any other pages on the site - it reverts back to the original image and size. I cleared cache but it hasn't changed.

  6. ian277
    Member
    Posted 2 years ago #

    Actually, after I uploaded a blank functions.php with your copied code, I was unable to access the dashboard of the site, so I removed the functions.php file and it was back to normal.

  7. Rev. Voodoo
    Volunteer Moderator
    Posted 2 years ago #

    Did you add the code to functions.php appropriately? As in, adding in the appropriate opening php tag?

    <?php
    
    //Add in your custom code below here
    
    function twentytwelvechild_custom_header_setup() {
    	$header_args = array( 'height' => 150, 'width' => 950 );
    	add_theme_support( 'custom-header', $header_args );
    }
    add_action( 'after_setup_theme', 'twentytwelvechild_custom_header_setup' );
  8. ian277
    Member
    Posted 2 years ago #

    I've added a new functions.php from a php in dreamweaver to your spec and it ended up on the homepage above the header.

    http://www.heavybrunch.com

  9. Rev. Voodoo
    Volunteer Moderator
    Posted 2 years ago #

    I don't see it there....

  10. ian277
    Member
    Posted 2 years ago #

    I just removed the functions.php all together because anything I would upload regarding the php code would show up above the header.

    And I've tried clearing cache but it's not working either. I see there is nothing above the header on another computer though.

  11. Rev. Voodoo
    Volunteer Moderator
    Posted 2 years ago #

    Are you sure your files are getting saved as php files?

    If your text is just showing up ... that's odd

  12. ian277
    Member
    Posted 2 years ago #

    Yeah, I created a new php file in dreamweaver, copied the above code and uploaded it to my child theme.

    Then all the code shows up above the header, so I just removed the functions.php file altogether and the header looks fine but some of the posts aren't showing up. Is it a caching issue? I've got two computers up and the site looks different using chrome as a browser on both computers.

    If there's no functions.php how is it working?

  13. pranam
    Member
    Posted 2 years ago #

    Hi,

    I posted the code recommended by alchymyth, The Sweeper & Moderator to change header dimensions and now I cannot access my dashboard at all and when I go to my website there is just a blank page.

    Can someone please tell mw how to fix this (what feels to me as) very big problem. It's urgent as I have an ad that begin to run tomorrow. : (

    Thanks so much.

  14. alchymyth
    Forum Moderator
    Posted 2 years ago #

    using FTP or the file management system of your hoster, rename functions.php of your child theme to something like old-functions.php

    this should allow you back into your site;
    you can then edit old-functions.php and repair the wrong edits.

    review
    http://codex.wordpress.org/Child_Themes#Using_functions.php

  15. pranam
    Member
    Posted 2 years ago #

    thanks for your prompt reply! I'll try your suggestion.

    The only change I had made to functions.php was to paste the suggested code since I wanted to achieve the same end (which is what I do when working with my ElegantThemes template). I made no other changes.

    I'm am not a WP expert or web developer, so my knowledge is limited. Is it possible for you to provide the original code for functions.php so I can just copy and paste once I get back into my account and avoid further missteps?

    Thanks again!

  16. alchymyth
    Forum Moderator
    Posted 2 years ago #

    there is no 'original' code for a functions.php of a child theme; it starts of empty apart from the php tags directly at the start and the end:

    <?php
    
    ?>

    if you are not using a child theme of Twenty Twelve, then do not use the code.

    there is no 'copy and paste' suggestion.

  17. pranam
    Member
    Posted 2 years ago #

    alchymyth, thanks for your help. I followed your suggestions and was able to get back to the point I started from.

  18. George Hozendorf
    Member
    Posted 1 year ago #

    Thanks for this topic. It worked perfectly. Put, the menu bar is overlapping the bottom of my image. This total newbie (3days old) doesn't have a clue what to change. Any suggestions will certainly be appreciated.

    Thanks.

Topic Closed

This topic has been closed to new replies.

About this Topic