Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // add_action( 'widgets_init', [$this,'addWidgets'] );
- public function addWidgets() {
- $optval=get_option('optname_widgets', my_sample_array_widgets);
- $additional_array = !empty($GLOBALS['MyWidgetss']) ? $GLOBALS['MyWidgetss'] : array();
- $widgets= array_merge( explode(',',$optval), $additional_array );
- if (!empty($widgets) ) {
- foreach ($widgets as $value){
- register_sidebar( array('name' => $value ,'id' => strtolower($value), 'before_widget'=>'<div class="sideb_clas '.$value.'">','after_widget'=>'</div>','before_title'=>'<h2 class="sideb_around">','after_title'=>'</h2>') );
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment