Skip to content

Instantly share code, notes, and snippets.

@humayunahmed8
Last active November 11, 2022 10:35
Show Gist options
  • Save humayunahmed8/e24a20a42bd6e7d81abae2beb41b29c0 to your computer and use it in GitHub Desktop.
Save humayunahmed8/e24a20a42bd6e7d81abae2beb41b29c0 to your computer and use it in GitHub Desktop.
Register sidebar
<?php
/**
* Register widget area.
*
* @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar
*/
function stock_humayunbd_widgets_init() {
register_sidebar( array(
'name' => esc_html__( 'Footer Widget', 'stock-humayunbd' ),
'id' => 'stock_footer',
'description' => esc_html__( 'Add Footer widgets here.', 'stock-humayunbd' ),
'before_widget' => '<div class="col-md-3 col-sm-6"><div id="%1$s" class="widget %2$s">',
'after_widget' => '</div></div>',
'before_title' => '<h4 class="widget-title">',
'after_title' => '</h4>',
) );
}
add_action( 'widgets_init', 'stock_humayunbd_widgets_init' );
<?php
// widget callbacks.
if(is_active_sidebar('stock_footer')) : ?>
<div class="row">
<?php dynamic_sidebar('stock_footer'); ?>
</div>
<?php endif; ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment