• Hi,
    my child theme seems to be correct installed because e.g. changes in style.css are working fine.
    I downloaded the child theme of functions.php here:
    https://www.themesandco.com/extension/customizr-child-theme/

    What I want to do is to add a new widget area and I used this:
    https://www.themesandco.com/snippet/add-widget-area-header/

    Out of this my functions.php in the child theme looks like this:

    <?php
    /**
    * This is where you can copy and paste your functions !
    */
    // Adds a widget area.
    if (function_exists('register_sidebar')) {
        register_sidebar(array(
        'name' => 'Extra Header Widget Area',
        'id' => 'extra-widget-area',
        'description' => 'Extra widget area after the header',
        'before_widget' => '<div class="widget my-extra-widget">',
        'after_widget' => '</div>',
        'before_title' => '<h2>',
        'after_title' => '</h2>'
        ));
    }

    [Moderator Note: Please post code & markup between backticks or use the code button. Your posted code may now have been permanently damaged by the forum’s parser.]

    I tried it with and without the ‘?>’ but when I go to Appearance > widgets there is NO new widget are (named ‘register_sidebar’).

    What can I do?

Viewing 2 replies - 1 through 2 (of 2 total)
  • The widget area is not the same as a widget. Rather, it’s an area that enables you to add widgets. Therefore, you now have a sidebar called ‘Extra Header Widget Area’ (not register_sidebar, which is the WP way of letting WP know that you have added a widget area) where you can place widgets. You should see this sidebar in the widgets area: try placing any of the existing widgets inside this sidebar and see if it works.

    Thread Starter KySo

    (@kyso)

    And the Winner is: Antonietta456
    You are right! ‘Extra Header Widget Area’ is the name and it is on the top
    of all widgets (I was looking for it at the bottom). Too difficult to read.
    Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Problem with child theme and functions.php’ is closed to new replies.