Cant add Widgets
-
Hi,
I am trying to add a widget after the slider and am using the code what i have found but nothing changes. I have tried several different ways, adding text, adding widgets but nothing changes. I am new and have created a child theme using childify me. Not sure what i am doing wrong.
Code i am using is..
// Adds a widget area.
if (function_exists(‘register_sidebar’)) {
register_sidebar(array(
‘name’ => ‘Extra Header Widget Area’,
‘id’ => ‘extra-widget-area’,
‘description’ => ‘Extra widget area after the header’,
‘before_widget’ => ‘<div class=”widget my-extra-widget”>’,
‘after_widget’ => ‘</div>’,
‘before_title’ => ‘<h2>’,
‘after_title’ => ‘</h2>’
));
}// Place the widget area after the header in home page only
add_action (‘__after_header’, ‘add_my_widget_area’, 10);
function add_my_widget_area() {
if ( tc__f(‘__is_home’) && function_exists(‘dynamic_sidebar’) ) {
dynamic_sidebar(‘Extra Header Widget Area’);
}
}I understand this will insert a widget after the header but once i get ti working i can change the positioning.
Hopefully someone can help me!!
Its probably something really easy I’m not doing..
Thanks
-
Hi,
1. Please post your site url.
2. This will add a widget area, yes. But you will not see any difference on your frontpage. Go to the customizr panel, Widgets. Here you will see the Extra Header Widget Area. Add some widget to this area, save and publish. Now you can see the difference on your front page.Hi,
I have managed to do it. I was typing the code intot he css not the php. lol.
I have put a image widget in this but it is left justified. How would i center it?.
Thanks
All sorted!..
Code wasn’t entered correctly..
Glad 🙂
The topic ‘Cant add Widgets’ is closed to new replies.
