im kind of a wordpress noob so please excuse my inexperience.

so long story short, ive been tasked with creating a WP theme (kinda simple) but, one of the areas, around footer area, has a few things they want, like a 2ndary menu/ bread crumbs etc...maybe even custom html box etc that i can do other things with later on, which i know WP provides via plugins / widgets etc but, my question is

how can i make a custom area to "hook" these onto a specific area of a page?

for example, in joomla, i can mark any part of a page with named hooks and thereafter, select whatever module i want to work with, assign said widget to the area by name and thats it, style it there after.

Does wordpress have anything like this?i know theyre different platforms but is there anything like it or a wordpress equivalent to achieve this.

i see for example that most of the widgets etc, go into the wp_sidebar. can i make my own area or are there other hooks that simulate what i described above?

Any tips/answers, links to read/research i gladly and humbly appreciate.

Thank you in advanced.

3 Answers 3


You can add additional widgetized sidebars to your theme by adding to your theme's functions.php.

If you have not already added widget support in the theme, include:

if (function_exists('register_sidebar'))

Then add:

// Footer Widgets
  'id' => 'footerwidgets',
  'name' => 'FooterWidgets',
  'description' => 'Widgets here are shown in the footer',
  'before_widget' => '<div id="%1$s" class="widget %2$s">',
  'after_widget'  => '</div>',
  'before_title' => '<h2>',
  'after_title' => '</h2>'

Then in your theme add <?php dynamic_sidebar( 'FoooterWidgets' ); ?>

Now simply go into Appearance >> Widgets to add whatever you like to this area.

Wordpress Codex - Widgetizing Themes

If you have not already added widget support, include

  • 1
    +1 For remembering the %2$s in the before_widget. I added the id also. Theme developers: Always let the Widget set the ID and class attributes! Apr 18, 2012 at 14:08
  • Hello, thanks for your informative reply. ive done as you said and all worked as it should, it appeared in the widgets area BUT, i cant see anything. any widgets i add to the module if you will, doesnt show on the page. when i do a quick test on Firebug to search for it, it doesnt appear in the code either so its not coming through at all. Any ideas? thanks again
    – somdow
    Apr 19, 2012 at 0:15
  • I just tested the code and it seems to be working as it is supposed to. Give me the URL and I will take a look at it. Apr 19, 2012 at 0:37
  • ahh man its not online, im running it on WAMP/MAMP here at the house. What do you think it could be? when i Firebug the page (i added a text widget and added dummy words ) and i look for it on the code, they dont come up, which lets me know theyre not coming through. any ideas? Thanks
    – somdow
    Apr 19, 2012 at 0:40
  • Hey original poster, long story short, i edited my code(based on yours) and added this to the top of it " if (function_exists('register_sidebar')) " and it worked. Edit your reply so i can mark it. Thanks
    – somdow
    Apr 19, 2012 at 0:58


Widget Areas: codex - Widgetizing Themes

Breadcrumbs: see this pastebin

  • +1 for the pastebin. I'm officially swiping for later use :)
    – David
    Apr 18, 2012 at 14:02

This doesn't answer all of your questions, but when I was learning the widgets it was hard for me to find a good reliable sample to learn from. So here's the one I used as reference to wrap my head around the enigma so to speak ;)

class my_custom_widget extends WP_Widget {
function my_custom_widget() {
    $widget_ops = array('classname' => 'text_plus_widget', 'description' => 'Title Bar, Text Area, and Link URL' );
    //WIDGET Name
    $this->WP_Widget('hs_text_plus', 'Text Plus Widget', $widget_ops);
function widget($args, $instance) {
    extract($args, EXTR_SKIP);
    echo $before_widget;
    //WIDGET Database Checks
    $title = empty($instance['title']) ? ' ' : apply_filters('widget_hs_text_plus_title', $instance['title']);
    $text_area = empty($instance['text_area']) ? ' ' : apply_filters('widget_hs_text_plus_text_area', $instance['text_area']);
    $link_url = empty($instance['link_url']) ? ' ' : apply_filters('widget_hs_text_plus_link_url', $instance['link_url']);

        <?php if ( !empty( $title ) && (strlen($title) > 1 )) { echo $before_title . $title . $after_title; }; ?>
        <?php if ( !empty( $text_area ) && (strlen($text_area) > 1 )) { echo '<p>' . $text_area . '</p>'; }; ?>
        <?php if ( !empty( $link_url ) && (strlen($link_url) > 1 )) { echo '<a href="' . $link_url . '">Click Here to Learn More</a>'; }; ?>
        <div class="clr" style="display: block; height: 20px;"></div>
    echo $after_widget;
function update($new_instance, $old_instance) {
    $instance = $old_instance;
    $instance['title'] = strip_tags($new_instance['title']);
    $instance['text_area'] = strip_tags($new_instance['text_area']);
    $instance['link_url'] = strip_tags($new_instance['link_url']);
    return $instance;
//WIDGET Admin Form
function form($instance) {
    //set your params, $instance and then any additional variables needed below
    $instance = wp_parse_args( (array) $instance, array( 'title' => '', 'text_area' => '', 'link_url' => '' ) );
    $title = strip_tags($instance['title']);
    $text_area = strip_tags($instance['text_area']);
    $link_url = strip_tags($instance['link_url']);
        <p><label for="<?php echo $this->get_field_id('title'); ?>">Widget Title: <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr__($title); ?>" /></label></p>
        <p><label for="<?php echo $this->get_field_id('text_area'); ?>">Widget Text: <textarea class="widefat" id="<?php echo $this->get_field_id('text_area'); ?>" name="<?php echo $this->get_field_name('text_area'); ?>" ><?php echo esc_attr__($text_area); ?></textarea></label></p>
        <p><label for="<?php echo $this->get_field_id('link_url'); ?>">Link URL: <input class="widefat" id="<?php echo $this->get_field_id('link_url'); ?>" name="<?php echo $this->get_field_name('link_url'); ?>" type="text" value="<?php echo esc_attr__($link_url); ?>" /></label></p>

 //CREATE Widget
 add_action( 'widgets_init', create_function('', 'return register_widget("my_custom_widget");') );

This isn't PHP5.3 syntax, however it's easily portable to that if you require it. Cheers!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.