WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Widget next to banner image twenty eleven theme (3 posts)

  1. Eckstein
    Member
    Posted 2 years ago #

    I know this questions has been asked MANY times and I've literally searched through probably 100 threads and "how-tos" but still can't get this to work.

    I (using a child theme of course) have deleted the code that renders the header-image in the header.php and replaced it with a table that will show a banner image that takes up about 70% of the screen and then a dynamic widget that takes up 30% on the right side.

    It's all working fine except I've tried so many different methods to get the widget to both display on the page and show up in the widget area of admin but every time I attempt something, it either doesn't work at all or gives me errors all over the place.

    Can somebody walk me through, step-by-detailed-step, how to do this successfully. Please don't point me to external links (like the WordPress codex). I've been over and over them without success.

    I have coding knowledge, but it is limited, so I need hand-holding sometimes.

    Thanks in advance.

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

    in functions.php, add for example:

    register_sidebar(array(
    'name'         => 'Custom Widget Area',
    'id'            => 'custom-widget',
    'description'   => 'a custom widget area',
    'before_widget' => '<li id="%1$s">',
    'after_widget'  => '</li>',
    'before_title'  => '<h2>',
    'after_title'   => '</h2>'    ));

    adapt the 'before_..' and 'after_..' html tags to what you need.

    http://codex.wordpress.org/Function_Reference/register_sidebar

    in your table cell, add for instance:

    <?php if ( is_active_sidebar( 'custom-widget' ) ) :
    dynamic_sidebar( 'custom-widget' );
    endif; ?>

    http://codex.wordpress.org/Function_Reference/dynamic_sidebar

    (related: http://www.transformationpowertools.com/wordpress/add-custom-widget-area-wordpress )

  3. Eckstein
    Member
    Posted 2 years ago #

    Thank you so much, this worked beautifully. I don't know why, but every other thread I've read has killed my site.

    Much thanks,
    z

Topic Closed

This topic has been closed to new replies.

About this Topic