WordPress.org

Forums

Widget Problem (3 posts)

  1. mladenmilinovic
    Member
    Posted 5 years ago #

    Hello,

    I am developing a new WordPress Theme and I've sent some versions to WordPress.
    I just got back some improvements before my Theme will be accepted.

    I took almost all task off except this one:

    The widget doesn't show up in the sidebar when somebody add this.

    My WordPress theme is an one-column Theme and the Sidebar can be a special site.

    How do I do that the Theme shows up the widget?

  2. MAzCastro
    Member
    Posted 5 years ago #

    put this on your sidebar:

    <?php if ( function_exists('dynamic_sidebar') && dynamic_sidebar(1) ) : else : ?>
       add some default code here, should the user no wish to use any widget
    <?php endif; ?>

    Create a new document called functions.php on your theme index.php root and add thgis code to it, or append the block to it, should you allready have one:

    <?php
    if ( function_exists('register_sidebar') )
        register_sidebars(1, array(
    	'name'=>'wdgtSpot %d','before_widget' => '',
    	'after_widget' => '',
    	'before_title' => '<div class="title">',
    	'after_title' => '</div>',
    ));
    ?>

    There is some unessencial markup in the code block, but I find it very usefull to style the widget´s titles.

    Hope this helps.

    MAC :)

  3. mladenmilinovic
    Member
    Posted 5 years ago #

    It works!

    Thank you very much!

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags