[HOWTO] [UPDATED] Add Widgets to Notepad-Chaos WordPress Theme

May 18th, 2009 Permalink

UPDATE: As wordpress does not show characters correctly, the codes below may not work. So please do copy the codes from this file I have uploaded. Please read the post as well as the instructions included in the file. You may need to use WinRAR or 7zip to extract the file if you are running [...]

UPDATE: As wordpress does not show characters correctly, the codes below may not work. So please do copy the codes from this file I have uploaded. Please read the post as well as the instructions included in the file. You may need to use WinRAR or 7zip to extract the file if you are running Windows.

The theme I’m using in this blog is widget unaware Notepad-Chaos theme. However, I have managed to allow it to add widgets.

I created a new file named functions.php in the directory wp-content/themes/notepad-chaos and put in the following code:
<?php
if ( function_exists(‘register_sidebar’) )
register_sidebar(array(‘name’=>’sidebar1′,
‘before_widget’ => ”,
‘after_widget’ => ”,
‘before_title’ => ‘<h4>’,
‘after_title’ => ‘</h4>’,
));
register_sidebar(array(‘name’=>’sidebar2′,
‘before_widget’ => ”,
‘after_widget’ => ”,
‘before_title’ => ‘<h4>’,
‘after_title’ => ‘</h4>’,
));
register_sidebar(array(‘name’=>’sidebar3′,
‘before_widget’ => ”,
‘after_widget’ => ”,
‘before_title’ => ‘<h4>’,
‘after_title’ => ‘</h4>’,
));
register_sidebar(array(‘name’=>’sidebar4′,
‘before_widget’ => ”,
‘after_widget’ => ”,
‘before_title’ => ‘<h4>’,
‘after_title’ => ‘</h4>’,
));
register_sidebar(array(‘name’=>’sidebar5′,
‘before_widget’ => ”,
‘after_widget’ => ”,
‘before_title’ => ‘<h4>’,
‘after_title’ => ‘</h4>’,
));
register_sidebar(array(‘name’=>’sidebar6′,
‘before_widget’ => ”,
‘after_widget’ => ”,
‘before_title’ => ‘<h4>’,
‘after_title’ => ‘</h4>’,
));
?>

So as to support a maximum of 6 widgets. Then, I opened up sidebar.php in the same directory and added in the following code at the end:

<?php if ( !function_exists(‘dynamic_sidebar’)
|| !dynamic_sidebar(‘sidebar1′) ) : ?>
<?php endif; ?>

<?php if ( !function_exists(‘dynamic_sidebar’)
|| !dynamic_sidebar(‘sidebar2′) ) : ?>
<?php endif; ?>

<?php if ( !function_exists(‘dynamic_sidebar’)
|| !dynamic_sidebar(‘sidebar3′) ) : ?>
<?php endif; ?>

<?php if ( !function_exists(‘dynamic_sidebar’)
|| !dynamic_sidebar(‘sidebar4′) ) : ?>
<?php endif; ?>

<?php if ( !function_exists(‘dynamic_sidebar’)
|| !dynamic_sidebar(‘sidebar5′) ) : ?>
<?php endif; ?>

<?php if ( !function_exists(‘dynamic_sidebar’)
|| !dynamic_sidebar(‘sidebar6′) ) : ?>
<?php endif; ?>

so as to support a maximum of 6 widgets to the sidebar. You may choose to edit the template elsewhere to place the widget as you like. Remember the names though (sidebar1, sidebar2, sidebar3 etc.) as you will need to know where the widget you are adding will go.

Now go to http://yoursite/wp-admin/widgets.php and you should be able to add widgets you choose.

Have Fun!

References:
How to Widget-Enable WordPress Themes in 3 Easy Steps
Multiple Dynamic Sidebars in WordPress


 [HOWTO] [UPDATED] Add Widgets to Notepad Chaos Wordpress Theme


If you enjoyed this post, make sure you subscribe to my RSS feed!
  • http://elvizy.com Elvizy

    Thanks a lot. I have suffered this problem for quite some time. Am going to try to do this manually and hope it works out

  • maiself

    not working for me, after update he file.. it give me blank blog — dunno what happened

  • http://precious-ink.net/ tane883

    thnx for the help… i was experimenting with those codes, but a blank page appear… then i just drag and drop a function.php and sidebar.php from other wordpress theme to this one and guess what….. IT WORKS!!!! :)

    i just come by and comment this because maybe someone else have the same problem ;)

    love from puerto rico.. remember apple rules!!!! XD

  • http://www.somsip.com Mark White

    Close but:

    functions.php need only be this for unlimited widgets:

    ”,
    ‘after_widget’ => ”,
    ‘before_title’ => ”,
    ‘after_title’ => ”,
    ));

    ?>

    And this needs to be added to sidebar.php, *before* the final

    It works here after having the blank blog problem as described by maiself.

  • http://www.somsip.com Mark White

    Gah – all tags were stripped. mod – please delete it, or use it to amend your post if you think it’s useful. Thanks.

  • LnddMiles

    Great post! I’ll subscribe right now wth my feedreader software!

  • http://www.chiels.nl Chiel S

    The above solution didn’t work for me. I have done the following:

    Create functions.php and add:

    ”,
    ‘after_widget’ => ”,
    ‘before_title’ => ”,
    ‘after_title’ => ”,
    ));
    ?>

    Add this on the bottom of your sidebar.php:

    Cheers,

    Chiel S

  • http://www.chiels.nl Chiel S

    Oke, adding code as comment doesn’t work as you can see. Send me an e-mail for the right code…

  • http://www.wirraldubs.co.uk Mike

    i got this to work with the notepad chaos theme

    there might be stuff in there thats not needed but it works :)

    functions.php:

    ’sidebar1′,
    ‘before_widget’ => ”,
    ‘after_widget’ => ”,
    ‘before_title’ => ‘’,
    ‘after_title’ => ‘’,
    ));
    register_sidebar(array(’name’=>’sidebar2′,
    ‘before_widget’ => ”,
    ‘after_widget’ => ”,
    ‘before_title’ => ‘’,
    ‘after_title’ => ‘’,
    ));
    register_sidebar(array(’name’=>’sidebar3′,
    ‘before_widget’ => ”,
    ‘after_widget’ => ”,
    ‘before_title’ => ‘’,
    ‘after_title’ => ‘’,
    ));
    register_sidebar(array(’name’=>’sidebar4′,
    ‘before_widget’ => ”,
    ‘after_widget’ => ”,
    ‘before_title’ => ‘’,
    ‘after_title’ => ‘’,
    ));
    register_sidebar(array(’name’=>’sidebar5′,
    ‘before_widget’ => ”,
    ‘after_widget’ => ”,
    ‘before_title’ => ‘’,
    ‘after_title’ => ‘’,
    ));
    register_sidebar(array(’name’=>’sidebar6′,
    ‘before_widget’ => ”,
    ‘after_widget’ => ”,
    ‘before_title’ => ‘’,
    ‘after_title’ => ‘’,
    ));
    ?>

    sidebar.php:

     

     

    Partner links

  • http://www.wirraldubs.co.uk Mike

    ignore other posts

    i have included a link so it displays :)

    http://www.wirraldubs.co.uk/index.php?option=com_content&view=article&id=68