• Hi,
    I want to remove the Twenty Ten image header <?php header_image(); ?> from one of my child themes.
    I want to do this by either using either the :-
    remove_action()
    or
    remove_filter()
    in the child function.php file.
    Is that possible, which to use and what is the code?
    Using wordpress 3 beta 2

Viewing 15 replies - 1 through 15 (of 19 total)
  • I’m trying to do the same. Aaron’s post, provided by MichaelH, doesn’t remove functions but adds additional features.

    So I sought advice at these three helpful articles:

    No success.

    Admittedly I’m not a pro at this. But it looks to me like the Twentyten setup functions and actions are all wrapped together in a way that makes them hard to pull apart and remove. For now I’ve made my own copy of Twenty Ten, renamed it (with due credits to the WordPress Team), and have simply removed the actions I don’t want.

    But if someone can successfully demonstrate how to do this in a child theme — i.e., remove just the custom header actions — I would certainly appreciate the help as well.

    I just released my child theme Twenty Ten Weaver, and this one was fairly difficult to solve. The only way I could figure out how to do it “right” was to change the header.php code. You can also do it with a filter and set the image height to 0, but that is kind of ugly, and still requires a child theme.

    But the header is included in the #branding section, and can’t be removed with just CSS.

    While I was mucking with the header.php anyway, I added the ability to completely replace the Twenty Ten header with your own by adding some code to the header div via a theme control panel.

    And just another plug – if you don’t want to build your own child theme (it is now pretty easy to do that with Twenty Ten), my theme Twenty Ten Weaver lets you change a bunch else with Twenty Ten, as well as insert your own CSS or HTML into the header, <HEAD>, and footer, all pretty painlessly. You can save what you’ve done in an external file for sharing or restoring across upgrades. And if you really need some specialty PHP stuff, you can modify one PHP file to do pretty much whatever you want. I used that capability to replace the header with a sliding photo menu instead.

    Does somebody already have an answer to this question? How to simply remove all custom header functionality in twenty ten with the help of the functions file in a child theme?

    Moderator t-p

    (@t-p)

    Go to Aaron’s website (see MichaelH respose), and read his response to the last comment where says: “I just wrote a quick post on how to do this. Check it out https://aaron.jorb.in/blog/2010/07/remove-all-default-header-images-in-a-twenty-ten-child-theme/ for the code you’re looking for.”

    hope this helps.

    It helps, but it’s not entirely what I wanted…

    I need the entire custom header functionality removed from twenty ten using the functions.php from my child theme. (So, I need the page etc. removed from the back-end as well.) Can somebody help me some more please?

    I tried to remove the custom header in style.css by setting the #branding img height to 0 in my child theme. This worked before the update of TT 7/23, but then it set the height of all images to 0… it seems that #branding extends the whole length of your page! (Yes, I checked this in the TT theme, it’s not just my child theme.) Double annoyance, because I was also trying to use a header image that was narrower and setting the height to less than 198–but it stretched photos in my pages to my new height, even overriding size information included with the photo url!

    I removed the whole business in header.php–not functions.php–by deleting it (you could comment it out, too). I began after the div branding was set up, and ended with an endif just before it code about the site-title.

    For a child theme, don’t copy all of TT, just style.css (with REQUIRED note at top) and any other folders you change. If you change header.php you must copy it to your child theme folder or it will be clobbered at next TT update.

    I tried this just last night, seems to work fine so far, but not extensively tested. Hope this helps.

    adding this function to the functions.php of your child theme allows you to avoid the ‘header’ option to show in ‘appearance’:

    function twentyten_setup() {
    /* leave the parts of the code in that you want to get executed;
    for instance, remove the code that does the custom header stuff */
    }

    the code in TwentyTen functions.php will only execute if the ‘twentyten_setup()’ function is not yet defined in the child theme:
    if ( ! function_exists( 'twentyten_setup' ) ):

    @alchymyth.. what you said works, but shouldn’t it be possible to use remove_action etc to create a clean and nice way to start fresh with your child theme?

    if ( !function_exists( 'child_theme_setup' ) ):
    	function child_theme_setup() {
    
    /* put in all the stuff to clean up the twentyten functions and start fresh. e.g. remove custom header functionality, remove widgets etc..  */ 
    
    }
    endif;

    I don’t really know how to do this..

    eekcm

    (@eekcm)

    Hi Is it possible to increase the depth of the header. I want to put a larger picture there?

    eekcm

    (@eekcm)

    sorry meant to say the picture size l want to put in is 940x300px so a deeper pik. Tried changing in functions but it wants to crop the image. Any ideas?

    govpatel

    (@govpatel)

    You can use this filter on your child theme functions.php

    add_filter('twentyten_header_image_height','my_header_height');
    add_filter('twentyten_header_image_width','my_header_width');
    function my_header_height($size){
       return 110;
    }
    function my_header_width($size){
       return 350;
    }

    Change the width and height to exact size of your header image.

    Go to your header.php in the twenty ten template file and look for the following code:
    <img src=”<?php header_image(); ?>” width=”<?php echo HEADER_IMAGE_WIDTH; ?>” height=”<?php echo HEADER_IMAGE_HEIGHT; ?>” alt=”” />

    Comment it out so that it looks like this:
    <!– <img src=”<?php header_image(); ?>” width=”<?php echo HEADER_IMAGE_WIDTH; ?>” height=”<?php echo HEADER_IMAGE_HEIGHT; ?>” alt=”” />–>

    Go to your header.php in the twenty ten template file and look for the following code:

    When you make any change in core twenty ten theme file next time you update the file will be over written so create a child theme and copy the file in child theme and make the change there.

    I was looking for how to do this as well, using the code from above, I added this to my child theme and it worked. Haven’t noticed any issues so far.

    function twentyten_setup() {
    /* leave the parts of the code in that you want to get executed;
    for instance, remove the code that does the custom header stuff */
    }
    add_custom_background();
    add_theme_support( 'post-thumbnails' );
Viewing 15 replies - 1 through 15 (of 19 total)
  • The topic ‘Twenty Ten Remove Header Image’ is closed to new replies.