Skip to content

Instantly share code, notes, and snippets.

@shahidulislamus
Last active August 29, 2015 14:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shahidulislamus/7f24a3f20fe8cce06a78 to your computer and use it in GitHub Desktop.
Save shahidulislamus/7f24a3f20fe8cce06a78 to your computer and use it in GitHub Desktop.
register sidebar which is generally called widget
function my_moderna_theme_widget() {
//how to register a widget
register_sidebar( array(
'name' => 'footer widget coloum 1', //the name of sidebar
'id' => 'footer_widget_coloum1', //an id to call this
'description' => 'put hear a widget to view in footer 1', // write it's description
'before_widget' => '<div class="widget">', //which html code go befor widget
'after_widget' => '</div>', //which html code go after widget
'before_title' => '<h5 class="widgetheading">', //which htm go before title
'after_title' => '</h5>', //which html code go after title
) );
}
add_action( 'widgets_init', 'my_moderna_theme_widget' ); // initialize widget
/////////////////////////Quary a sidebar i mean widget
<?php if(! dynamic_sidebar('footer1')): ?> //arter the widget ..hear footer1 in the id from regester sidebar
//hear stay html code
//which is ignore when a widget find from daynamic system
<?php endif; ?> //put this code after widget
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment