Skip to content

Instantly share code, notes, and snippets.

@azharisubroto
Created October 8, 2015 04:18
Show Gist options
  • Save azharisubroto/2fd63d9557b6c4ebc96a to your computer and use it in GitHub Desktop.
Save azharisubroto/2fd63d9557b6c4ebc96a to your computer and use it in GitHub Desktop.
<?php
/**
* Register widget areas.
*/
function _action_theme_widgets_init() {
if( function_exists('fw_get_db_settings_option') ){
$sections = fw_get_db_settings_option('footer_section');
if(!empty($sections)){
foreach ($sections as $section) {
$footer_widgets = $section['footer_widgets'];
if(!empty($footer_widgets)){
$i=0;
foreach ($footer_widgets as $footer_widget) {
register_sidebar( array(
'name' => $footer_widget['footer_widget_name'],
'id' => strtolower(str_replace(' ', '-', $footer_widget['footer_widget_name'])),
'before_widget' => '<div class="zl_foo_widget" id="%1$s">',
'after_widget' => '<div class="clear"></div></div>',
'before_title' => '<h3 class="zl_foo_wid_head"><span>',
'after_title' => '</span></h3>',
) );
$i++;
}
}
}
}
}
}
add_action( 'widgets_init', '_action_theme_widgets_init' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment