WordPress.org

Ready to get started?Download WordPress

Forums

Child theme - Header (10 posts)

  1. SoniaTBB
    Member
    Posted 1 year ago #

    Hi,

    I'm using twentyeleven and I would like to remove the kind of search bar there is by default on the very top of a wordpress website. I'd like to remove it from my child theme.

    So far, i've not created a child header.php
    What i don't understand is : if you want to add something to your header, you create a child header.php, you insert your thing and then the rest will be loaded with the parent header.php BUT if i want to REMOVE something that is on the parent header.php, how do i have to do ?

    Should i just make a full copy of the parent header.php and put it in the child theme folder ?

    Thanks for your help

    ps : i know how to remove it on the parent theme, i just don't know how to deal with this and the child theme

  2. WPyogi
    Volunteer Moderator
    Posted 1 year ago #

    The child theme uses the entire header.php that is in the child theme (if one) - so you'd just make the change there. It won't load part of the header.php from the parent.

  3. WPThemes.co.nz
    Member
    Posted 1 year ago #

    Hi Sonia,

    Think of it like this: generally, any template file you put on the child theme will override the template file on the parent theme.

    If you only want to override the header.php file, then just have that file on your child theme folder, and the rest of the template files will be taken from the parent theme.

    So, if you want to "remove" or "add" something then that is a modification which means you will want to override the file from the parent theme.

    So yes, just make a full copy of the parent header.php file and put it in the child theme folder and remove the search bar from that new file. WP will then use the file in the child theme instead of the file from the parent theme.

  4. SoniaTBB
    Member
    Posted 1 year ago #

    Thanks for your answer.
    So, the only thing i have to do (as i have no child-header so far), is to copy the original one to the child-folder and to modify it ?

  5. Konstantinos Kouratoras
    Member
    Posted 1 year ago #

    Exactly, copy header file to child-folder and modify the way you want.

  6. SoniaTBB
    Member
    Posted 1 year ago #

    Thanks a lot to both of you :)

    One last thing i want to be sure of : about style.css, i just have to create a child file, with the following code :

    /*
    Theme Name: Twenty ElevenChild
    Template: twentyeleven
    */
    @import url("../twentyeleven/rtl.css");

    Then the only things i need to add are the modifications i want. Right ? I don't need to copy the whole file

    Thanks again

  7. SoniaTBB
    Member
    Posted 1 year ago #

    Speaking of the header but it doesn't have anything to do with child theme.
    Look at my website please : http://www.soniarochel.com
    How can i modify the margin between the title of my website and the picture of the header ?

    Thanks

  8. WPyogi
    Volunteer Moderator
    Posted 1 year ago #

    Your child theme is not active - once you set it up, you have to switch to it -- like switching to any other different theme.

  9. SoniaTBB
    Member
    Posted 1 year ago #

    I know it is not active.
    I think you don't understand my question. Forget the parent or child theme. I want to know how to reduce the margin between the title and the picture of the header

    Thanks

  10. WPyogi
    Volunteer Moderator
    Posted 1 year ago #

    That space is created by the "site description" (tagline) - leaving it blank in your settings doesn't get rid of it on the site. So try this:

    #site-description {
       display: none;
    }

Topic Closed

This topic has been closed to new replies.

About this Topic