WordPress.org

Ready to get started?Download WordPress

Forums

Add widget area to header in TwentyEleven child theme (8 posts)

  1. shanafourde
    Member
    Posted 2 years ago #

    I am trying to add a widget area to the header area of my twentyeleven child theme.

    I am trying to follow the instructions here:
    http://wordpress.org/support/topic/twenty-eleven-extra-widget-area

    BUT I can't get the widget area to show up in the admin Widgets page.

    Am I missing a step?

  2. wildwood
    Member
    Posted 2 years ago #

    I am also trying to add a widget area to the header. I want it to go just above the search box. But am having problems!

    So far I have.....
    (1) registered the widget by adding the following to the functions.php in my child theme:

    <!-- adding phone number above search box - This will register the widget area-->
    	<?php
        register_sidebar( array(
            'name' => __( 'Header Widget', 'twentyeleven-child' ),
            'id' => 'header-widget',
            'before_widget' => '<div id="%1$s" class="widget %2$s">',
            'after_widget' => "</div>",
            'before_title' => '<h3 class="widget-title">',
            'after_title' => '</h3>',
        ) );
        ?>

    (2) Added the following to header.php in my child theme:

    <!-- adding widget to hold phone number above search box-->
                <div><?php techild_header_widget(); ?></div>

    just above the following lines that were already there:

    <div class="only-search<?php if ( ! empty( $header_image ) ) : ?> with-image<?php endif; ?>">
    				<?php get_search_form(); ?>
    				</div>

    (3)Added some style in the css file of the child theme:

    /* for phone number in header widget */
    header#branding .widget{
        position: absolute;
        top: 2em;
        rightright: 7.6%;
    	color: #c02336; font-size: 18px;
        }

    (4) In the admin panel, I can see the header widget area now listed in the widget areas. I drug and dropped the "text" widget over and used it to type in the text I wanted to display (which is a phone number).

    But nothing is showing up on the site. (at least I didn't get any of the dreaded fatal error messages when the page loaded) WHERE DID I GO WRONG?

  3. alchymyth
    The Sweeper & Moderator
    Posted 2 years ago #

    where have you defined this function:
    techild_header_widget();
    and what code is in it?

  4. alchymyth
    The Sweeper & Moderator
    Posted 2 years ago #

    in step(2) you could just use something like:

    <?php if ( is_active_sidebar( 'header-widget' ) ) : ?>
    <div><?php dynamic_sidebar( 'header-widget' ); ?></div>
    <?php endif; ?>
  5. Jan1979
    Blocked
    Posted 1 year ago #

    For anyone interested:
    http://www.huurautohuren.com/twenty-eleven-child-theme-free-download/

    It's a twenty eleven child theme with only two changes, it has sidebar support for posts and adds 4 widget area's to the header. So you can use this one, or have a look at the code and implement it in yours.

  6. Tw55
    Member
    Posted 1 year ago #

    Hi Jan1979,
    Thanks for sharing the child theme. I added a widget on the header (below the navigation/menu) and I want to add a background image to that area. How do I do it? Do I use z-index in css?Thank you and thanks anyone who answers.

  7. pikpi1965
    Member
    Posted 1 year ago #

    I am using Weaver II theme. Is there a way I can add a header widget?

    Honestly speaking, I am trying to really define a simple shopping cart with a few options - example a category which has 4 choices: family, single, single family and single student. Based on each choice, a specific price shall be defined.

    Please let me know if you have suggestions.

    Thanks for your help.

  8. alchymyth
    The Sweeper & Moderator
    Posted 1 year ago #

    @pikpi1965

    please start you own topic

    - your problem is different as you are not even using the same theme.

Topic Closed

This topic has been closed to new replies.

About this Topic