Forums

How Do I Add Widgets in WordPress 3.0 (2 posts)

  1. pknox
    Member
    Posted 1 year ago #

    I thought I would find Widgets under the Appearance Menu as per one of the on line turorial videos but it's not there. I am new to WordPress and blogging and would appreciate any advice. Thanks

  2. richarduk
    Member
    Posted 1 year ago #

    If it's not there under Appearance it presumably means that widgets need to be enabled.

    In functions.php add something like this to give two places where widgets can go:

    if ( function_exists('register_sidebar') )
    	register_sidebar(1);
    	register_sidebar(2);

    In your page e.g. index.php or category.php add something like this to create two separate 'containers' for widgets:

    <div id="box-whatever">
    <ul class="ul-something">
    <?php if ( function_exists('dynamic_sidebar') && dynamic_sidebar(1) ) : else : ?>
    <p>Some default text here in case you forget to put a  widget in </p>
    <?php endif; ?>
    </ul>
    </div>
    
    <div id="box-whatever">
    <ul class="ul-something">
    <?php if ( function_exists('dynamic_sidebar') && dynamic_sidebar(2) ) : else : ?>
    <p>Some default text here in case you forget to put a  widget in </p>
    <?php endif; ?>
    </ul>
    </div>

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags