May 10, 2020 10:10 am
I will like to create a custom widget in my wpforo. How possible this. This is how I created one in my wordpress theme.
I added the code below on my wordpress theme function.php.
function wpb_widgets_init() { register_sidebar( array( 'name' => 'Custom Header Widget Area', 'id' => 'custom-header-widget', 'before_widget' => '<div class="chw-widget">', 'after_widget' => '</div>', 'before_title' => '<h2 class="chw-title">', 'after_title' => '</h2>', ) ); } add_action( 'widgets_init', 'wpb_widgets_init' );
Then add this to the place i want the widget to be. But I tried it on wpforo it didn't work.Β
Β
<?php if ( is_active_sidebar( 'custom-header-widget' ) ) : ?> <div id="header-widget-area" class="chw-widget-area widget-area" role="complementary"> <?php dynamic_sidebar( 'custom-header-widget' ); ?> </div> <?php endif; ?>
1 Reply
May 10, 2020 7:46 pm
Solved I added the first code in my theme's function.php then the second in wpforo.Β