Astra Child Theme Widgets
-
Hello,
I am trying to build a custom Astra Child theme. I am trying to add 2 extra widget areas to my theme.
In the fuctions.php file I have these:
if ( function_exists('register_sidebar') ) { register_sidebar(array( 'name' => 'Info Box Left', 'before_widget' => '<div id="%1$s" class="widget %2$s">', 'after_widget' => '</div>', 'before_title' => '<h2>', 'after_title' => '</h2>' )); register_sidebar(array( 'name' => 'Info Box Right', 'before_widget' => '<div id="%1$s" class="widget %2$s">', 'after_widget' => '</div>', 'before_title' => '<h2>', 'after_title' => '</h2>' )); };However this only shows the Info Box Right in the WordPress widget admin area. I have to add a a dummy widget before these for the to both show up. It’s as if the first widget is not getting registered but the ones after it are.
if ( function_exists('register_sidebar') ) { register_sidebar(array( 'name' => 'Fake Widget', 'before_widget' => '', 'after_widget' => '', 'before_title' => '', 'after_title' => '' )); register_sidebar(array( 'name' => 'Topbar Left', 'before_widget' => '<div id="%1$s" class="widget %2$s">', 'after_widget' => '</div>', 'before_title' => '<h2>', 'after_title' => '</h2>' )); register_sidebar(array( 'name' => 'Topbar Right', 'before_widget' => '<div id="%1$s" class="widget %2$s">', 'after_widget' => '</div>', 'before_title' => '<h2>', 'after_title' => '</h2>' )); };Anyone know why this is happening?
Thanks
Viewing 1 replies (of 1 total)
-
Hi @chudz ,
It seems like there is some issue in your code. Please take a reference from this article that will let you know how you can register the widget area.
Please go through the article, and I am sure it will help.
Regards,
Deepak
Viewing 1 replies (of 1 total)
The topic ‘Astra Child Theme Widgets’ is closed to new replies.
