Skip to:
Content
Pages
Categories
Search
Top
Bottom

BP 1.2 – removing custom image header code in child theme did not work


  • mkels
    Participant

    @mkels

    hi

    i’m using bp 1.2 and wpmu 2.9.1.1

    using the code remove_action() suggested in bp-default

    remove_action( 'init', 'bp_dtheme_add_custom_header_support' );

    inside child theme’s functions.php.

    where in my child theme, i had another custom image header also.

    the situation now are 2 custom header admin menu and 2 upload form inisde custom header page.

Viewing 19 replies - 1 through 19 (of 19 total)
  • i can report that, the remove action in “init” are not working, taken too far in the process i suppose, but they are not working. btw, wouldn’t it be more logical to move that action to a wp_head or something?


    ozzysong
    Participant

    @ozzysong

    I’ve got the same problem trying to remove the custom header image.

    All the other actions I’m removing works ok.

    Report this as a bug on https://trac.buddypress.org/, I think init is too early.

    Works perfectly fine for me.

    I have a empty function.php in my child’s theme, however, it has that one line:

    <?php remove_action( ‘init’, ‘bp_dtheme_add_custom_header_support’ ); ?>

    Make sure there isn’t any other function that may override the bp-defaults.

    If that doesn’t work, you can attempt to copy the function and replacing the the few lines with a return call.

    Erm Scratch what I just said. After going to the latest RC from a “Fresh Install”

    I can confirm that this init is no longer working as well.

    File a bug for this please, it was working before so something must have happened.


    mkels
    Participant

    @mkels

    thanks for the response guys:)

    i see previous trac log had this

    Allow child themes to completely remove custom image header settings in bp-default by using remove_action( 'template_redirect', 'bp_dtheme_add_custom_header_support' ); in their functions.php file.

    maybe the remove_action() on this work…

    haven’t tried it yet.


    fostertime
    Participant

    @fostertime

    I tried it. Doesn’t work. :)


    Leia Scofield
    Participant

    @leiascofield

    A temporary quick fix would be to add the following to your child theme’s CSS:

    If you don’t want any image:

    #header { background: none !important }

    If you want some other image:

    #header { background: url(/path/to/image.gif) !important }

    Ah yes… the good old “!Important” keyword :o)


    Roger Coathup
    Participant

    @rogercoathup

    Just a quick thought (I don’t know the answer):

    Is it an order of ‘inclusion’ issue with the functions.php files?

    i.e. does the parent (bp-default) functions.php get included after the child theme functions.php? So, the remove_action is occurring before the add_action?


    MrMaz
    Participant

    @mrmaz

    Since the child theme functions.php loads first you have to add an action that removes the other action before it tries to execute it. Since the core action runs at default priority 10, you just have to hook in at priority 9.

    Here is how to do it:

    function remove_header_support() {
    remove_action( 'init', 'bp_dtheme_add_custom_header_support' );
    }
    add_action( 'init', 'remove_header_support', 9 );


    fostertime
    Participant

    @fostertime

    Excellent. Works perfectly. Thanks MrMaz


    featherodd
    Participant

    @featherodd

    Works :) Very clever MrMaz!

    MrMaz for president…

    hum, ok, maybe not… as dedicated and friendly coder, well !!!

    ;)


    mkels
    Participant

    @mkels

    function remove_header_support() {

    remove_action( 'init', 'bp_dtheme_add_custom_header_support' );

    }

    add_action( 'init', 'remove_header_support', 9 );

    this works!…thanks guys and MrMaz


    michaelmarian
    Participant

    @michaelmarian

    I used this successfully as well. Thanks!

    I have a slightly different need. I got rid of the header and have my own, but on my home page I have a larger header area then on all other pages. I solved this by php code by detecting if on the home page:

    <?php if( bp_is_front_page() ){ ?>

    <link rel=’stylesheet’ href=’wp-content/themes/coffeehouse/large-masthead.css’ type=’text/css’ media=’screen’ />

    <?php } ?>

    I can also do this for other pages by determining the slug such as Blogs.

    How do I do the same for the child pages of the Members area? Is that a different directory? I tried using the template tags without success.


    mira360
    Participant

    @mira360

    Tip: Remove custom headers in your child theme

    If you want to remove the ability to have custom headers in your child theme you simply add the following line in functions.php for your child or parent theme:

    define( ‘BP_DTHEME_DISABLE_CUSTOM_HEADER’, true );

    more easy , true?

Viewing 19 replies - 1 through 19 (of 19 total)
  • The topic ‘BP 1.2 – removing custom image header code in child theme did not work’ is closed to new replies.
Skip to toolbar