Topic: How to add extra widgets

I'm looking to add two more extra widgets to my homepage. Using the code below I've managed to add two widgets which show on the homepage, but they don't show in the CMS so I'm unable to edit them. What is it that I've missed?

test site - http://wp.intanexus.com/

I've created a child theme and added this to functions.php

register_sidebar(array(
            'name' => __('Home Widget 4', 'responsive'),
            'description' => __('Area Ten - sidebar-home.php', 'responsive'),
            'id' => 'home-widget-4',
            'before_title' => '<div id="widget-title-four" class="widget-title-home"><h3>',
            'after_title' => '</h3></div>',
            'before_widget' => '<div id="%1$s" class="widget-wrapper %2$s">',
            'after_widget' => '</div>'
        ));
        
        register_sidebar(array(
            'name' => __('Home Widget 5', 'responsive'),
            'description' => __('Area Eleven - sidebar-home.php', 'responsive'),
            'id' => 'home-widget-5',
            'before_title' => '<div id="widget-title-five" class="widget-title-home"><h3>',
            'after_title' => '</h3></div>',
            'before_widget' => '<div id="%1$s" class="widget-wrapper %2$s">',
            'after_widget' => '</div>'
        ));

I've also added this to sidebar-home.php

<div class="grid widget-home-4">
        <?php responsive_widgets(); // responsive above widgets hook ?>
            
            <?php if (!dynamic_sidebar('home-widget-4')) : ?>
            <div class="widget-wrapper">
            
                <div class="widget-title-home"><h3><?php _e('Home Widget 4', 'responsive'); ?></h3></div>
                <div class="textwidget"><?php _e('This is your fourth home widget box. To edit please go to Appearance > Widgets and choose 10th widget from the top in area ten called Home Widget 4. Title is also managable from widgets as well.','responsive'); ?></div>
            
            </div><!-- end of .widget-wrapper -->
            <?php endif; //end of home-widget-4 ?>
            
        <?php responsive_widgets_end(); // after widgets hook ?>
        </div><!-- end of .col-300 -->
        
        <div class="grid widget-home-5 fit">
        <?php responsive_widgets(); // above widgets hook ?>
            
            <?php if (!dynamic_sidebar('home-widget-5')) : ?>
            <div class="widget-wrapper">
            
                <div class="widget-title-home"><h3><?php _e('Home Widget 5', 'responsive'); ?></h3></div>
                <div class="textwidget"><?php _e('This is your firth home widget box. To edit please go to Appearance > Widgets and choose 11th widget from the top in area eleven called Home Widget 5. Title is also managable from widgets as well.','responsive'); ?></div>
        
            </div><!-- end of .widget-wrapper -->
            <?php endif; //end of home-widget-5 ?>

Re: How to add extra widgets

You're missing:

function responsive_child_widgets_init() {

and

add_action('widgets_init', 'responsive_child_widgets_init');

See /includes/functions.php on the end and compare.

Emil

rasins wrote:

I'm looking to add two more extra widgets to my homepage. Using the code below I've managed to add two widgets which show on the homepage, but they don't show in the CMS so I'm unable to edit them. What is it that I've missed?

test site - http://wp.intanexus.com/

I've created a child theme and added this to functions.php

register_sidebar(array(
            'name' => __('Home Widget 4', 'responsive'),
            'description' => __('Area Ten - sidebar-home.php', 'responsive'),
            'id' => 'home-widget-4',
            'before_title' => '<div id="widget-title-four" class="widget-title-home"><h3>',
            'after_title' => '</h3></div>',
            'before_widget' => '<div id="%1$s" class="widget-wrapper %2$s">',
            'after_widget' => '</div>'
        ));
        
        register_sidebar(array(
            'name' => __('Home Widget 5', 'responsive'),
            'description' => __('Area Eleven - sidebar-home.php', 'responsive'),
            'id' => 'home-widget-5',
            'before_title' => '<div id="widget-title-five" class="widget-title-home"><h3>',
            'after_title' => '</h3></div>',
            'before_widget' => '<div id="%1$s" class="widget-wrapper %2$s">',
            'after_widget' => '</div>'
        ));

I've also added this to sidebar-home.php

<div class="grid widget-home-4">
        <?php responsive_widgets(); // responsive above widgets hook ?>
            
            <?php if (!dynamic_sidebar('home-widget-4')) : ?>
            <div class="widget-wrapper">
            
                <div class="widget-title-home"><h3><?php _e('Home Widget 4', 'responsive'); ?></h3></div>
                <div class="textwidget"><?php _e('This is your fourth home widget box. To edit please go to Appearance > Widgets and choose 10th widget from the top in area ten called Home Widget 4. Title is also managable from widgets as well.','responsive'); ?></div>
            
            </div><!-- end of .widget-wrapper -->
            <?php endif; //end of home-widget-4 ?>
            
        <?php responsive_widgets_end(); // after widgets hook ?>
        </div><!-- end of .col-300 -->
        
        <div class="grid widget-home-5 fit">
        <?php responsive_widgets(); // above widgets hook ?>
            
            <?php if (!dynamic_sidebar('home-widget-5')) : ?>
            <div class="widget-wrapper">
            
                <div class="widget-title-home"><h3><?php _e('Home Widget 5', 'responsive'); ?></h3></div>
                <div class="textwidget"><?php _e('This is your firth home widget box. To edit please go to Appearance > Widgets and choose 11th widget from the top in area eleven called Home Widget 5. Title is also managable from widgets as well.','responsive'); ?></div>
        
            </div><!-- end of .widget-wrapper -->
            <?php endif; //end of home-widget-5 ?>

Re: How to add extra widgets

Oh yes thank you Emil. Although adding these in hasn't made my widgets appear/show in the CMS. 

I'm really stumped.  sad


Emil wrote:

You're missing:

function responsive_child_widgets_init() {

and

add_action('widgets_init', 'responsive_child_widgets_init');

See /includes/functions.php on the end and compare.

Emil

Re: How to add extra widgets

Backtrace your steps and make them exactly as I did in /includes/functions.php

/responsive-child-theme/functions.php

<?php
    /**
     * WordPress Widgets start right here.
     */
    function responsive_child_widgets_init() {

        register_sidebar(array(
            'name' => __('Home Widget 4', 'responsive'),
            'description' => __('Area Nine - sidebar-home.php', 'responsive'),
            'id' => 'home-widget-4',
            'before_title' => '<div id="widget-title-three" class="widget-title-home"><h3>',
            'after_title' => '</h3></div>',
            'before_widget' => '<div id="%1$s" class="widget-wrapper %2$s">',
            'after_widget' => '</div>'
        ));

    }
    
    add_action('widgets_init', 'responsive_child_widgets_init');
?>

/responsive-child-theme/home.php

        <div class="grid col-300">
        <?php responsive_widgets(); // above widgets hook ?>
            
            <?php if (!dynamic_sidebar('home-widget-4')) : ?>
            <div class="widget-wrapper">
            
                <div class="widget-title-home"><h3><?php _e('Home Widget 4', 'responsive'); ?></h3></div>
                <div class="textwidget"><?php _e('This is your first home widget box. To edit please go to Appearance > Widgets and choose 6th widget from the top in area six called Home Widget 1. Title is also managable from widgets as well.','responsive'); ?></div>
            
            </div><!-- end of .widget-wrapper -->
            <?php endif; //end of home-widget-4 ?>

        <?php responsive_widgets_end(); // responsive after widgets hook ?>
        </div><!-- end of .col-300 -->

That's all smile

Emil

rasins wrote:

Oh yes thank you Emil. Although adding these in hasn't made my widgets appear/show in the CMS. 

I'm really stumped.  sad


Emil wrote:

You're missing:

function responsive_child_widgets_init() {

and

add_action('widgets_init', 'responsive_child_widgets_init');

See /includes/functions.php on the end and compare.

Emil

Re: How to add extra widgets

I was missing 'responsive_child' on the end of each widget. Silly me.

Thank you very much for pointing me in the right direction. Excellent theme by the way. smile

Re: How to add extra widgets

Glad to help!

Emil

rasins wrote:

I was missing 'responsive_child' on the end of each widget. Silly me.

Thank you very much for pointing me in the right direction. Excellent theme by the way. smile

Re: How to add extra widgets

Emil,
I'd like to add three more widgets underneath the first three home widgets in my child theme.  Can you tell me what code I paste (from this post) and exactly where to place it inside home.php and functions.php?  I am not sure from this post what code I should use.  A point in the right direction is much appreciated!

Re: How to add extra widgets

No need for codes, just go to Appearance > Widgets (locate current) and add above them that's all, they will stack one after another. You can multiple them and there's no limit how many.

Emil

emily wrote:

Emil,
I'd like to add three more widgets underneath the first three home widgets in my child theme.  Can you tell me what code I paste (from this post) and exactly where to place it inside home.php and functions.php?  I am not sure from this post what code I should use.  A point in the right direction is much appreciated!

Re: How to add extra widgets

oh great.  thanks smile 

Emil wrote:

No need for codes, just go to Appearance > Widgets (locate current) and add above them that's all, they will stack one after another. You can multiple them and there's no limit how many.

Emil

emily wrote:

Emil,
I'd like to add three more widgets underneath the first three home widgets in my child theme.  Can you tell me what code I paste (from this post) and exactly where to place it inside home.php and functions.php?  I am not sure from this post what code I should use.  A point in the right direction is much appreciated!

Re: How to add extra widgets

no problem

emily wrote:

oh great.  thanks smile 

Emil wrote:

No need for codes, just go to Appearance > Widgets (locate current) and add above them that's all, they will stack one after another. You can multiple them and there's no limit how many.

Emil

emily wrote:

Emil,
I'd like to add three more widgets underneath the first three home widgets in my child theme.  Can you tell me what code I paste (from this post) and exactly where to place it inside home.php and functions.php?  I am not sure from this post what code I should use.  A point in the right direction is much appreciated!