'Default Sidebar', 'id' => 'displayed_everywhere', 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

' )); register_sidebar(array( 'name' => 'Post Left Sidebar', 'id' => 'post_left_sidebar', 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

' )); register_sidebar(array( 'name' => 'Post Right Sidebar', 'id' => 'post_right_sidebar', 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

' )); register_sidebar(array( 'name' => 'Page Left Sidebar', 'id' => 'page_left_sidebar', 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

' )); register_sidebar(array( 'name' => 'Page Right Sidebar', 'id' => 'page_right_sidebar', 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

' )); register_sidebar(array( 'name' => 'Category Sidebar', 'id' => 'category_sidebar', 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

' )); register_sidebar(array( 'name' => 'Tag Sidebar', 'id' => 'tag_sidebar', 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

' )); register_sidebar(array( 'name' => 'Archive Sidebar', 'id' => 'archive_sidebar', 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

' )); register_sidebar(array( 'name' => 'Search Sidebar', 'id' => 'search_sidebar', 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

' )); register_sidebar(array( 'name' => 'Page 404 Left Sidebar', 'id' => 'page_404_left_sidebar', 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

' )); register_sidebar(array( 'name' => 'Page 404 Right Sidebar', 'id' => 'page_404_right_sidebar', 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

' )); $home_sections = get_option('_meris_home_widget_area'); if($home_sections !=""){ $home_sections_array = json_decode($home_sections, true); if(isset($home_sections_array['section-widget-area-name']) && is_array($home_sections_array['section-widget-area-name']) ){ $num = count($home_sections_array['section-widget-area-name']); for($i=0; $i<$num; $i++ ){ $areaname = isset($home_sections_array['section-widget-area-name'][$i])?$home_sections_array['section-widget-area-name'][$i]:""; $sanitize_areaname = sanitize_title($areaname); $color = isset($home_sections_array['list-item-color'][$i])?$home_sections_array['list-item-color'][$i]:""; $image = isset($home_sections_array['list-item-image'][$i])?$home_sections_array['list-item-image'][$i]:""; $repeat = isset($home_sections_array['list-item-repeat'][$i])?$home_sections_array['list-item-repeat'][$i]:""; $position = isset($home_sections_array['list-item-position'][$i])?$home_sections_array['list-item-position'][$i]:""; $attachment = isset($home_sections_array['list-item-attachment'][$i])?$home_sections_array['list-item-attachment'][$i]:""; $layout = isset($home_sections_array['widget-area-layout'][$i])?$home_sections_array['widget-area-layout'][$i]:""; $padding = isset($home_sections_array['widget-area-padding'][$i])?$home_sections_array['widget-area-padding'][$i]:""; $column = isset($home_sections_array['widget-area-column'][$i])?$home_sections_array['widget-area-column'][$i]:""; $columns = isset($home_sections_array['widget-area-column-item'][$sanitize_areaname ])?$home_sections_array['widget-area-column-item'][$sanitize_areaname ]:array("12"); $j = 1; $column_num = count($columns); foreach($columns as $widget){ if($column_num > 1){ $widget_name = esc_attr($areaname)." Column ".$j; }else{ $widget_name = esc_attr($areaname); } register_sidebar(array( 'name' => $widget_name, 'id' => sanitize_title($widget_name), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

' )); $j++; } } } } register_widget('meris_home_service_block'); register_widget('meris_home_divider'); register_widget('meris_home_slogan'); register_widget('meris_home_portfolio_block'); register_widget('meris_home_contact'); register_widget('meris_home_title'); register_widget('meris_sidebar_slider'); register_widget('meris_sidebar_social'); register_widget('meris_post_tabs'); register_widget('meris_team'); } add_action( 'widgets_init', 'meris_widgets_init' ); /** * Home page service widget */ // service structure 1 class meris_home_service_block extends WP_Widget { function meris_home_service_block() { $widget_ops = array( 'classname' => 'home_widget_service', 'description' => __( 'Display pages as service.', 'meris' ) ); $control_ops = array( 'width' => 350, 'height' =>250 ); parent::WP_Widget( false, $name = __( 'Meris: Service', 'meris' ), $widget_ops, $control_ops); } function form( $instance ) { for($i=0;$i<4;$i++){ $defaults['service_'.$i] = ''; $defaults['icon_'.$i] = ''; $defaults['color_'.$i] = ''; } $instance = wp_parse_args( (array) $instance, $defaults ); for($i=0;$i<4;$i++){ ?>

' ','name' => $this->get_field_name( 'service_'.$i ), 'selected' => absint($instance[ 'service_'.$i]) ) ); ?>

-1, 'post_type' => array( 'page' ), 'post__in' => $page_array, 'orderby' => 'post__in' ) ); echo $before_widget; $j = 0; $list_num = count($page_array); switch($list_num){ case 1: $column = "12"; break; case 2: $column = "6"; break; case 3: $column = "4"; break; case 4: $column = "3"; break; } if(count($page_array)>0){ while( $get_service_pages->have_posts() ):$get_service_pages->the_post(); $icon = $icon_array[$j]; $color = $color_array[$j]; if($icon != ""){ if(strstr($icon,"http")){ $icon = ''; }else{ if($color != "") $icon_style = 'color:'.$color.';';else $icon_style = ""; $icon = ''; } } echo '
'.$icon.'

'.get_the_title().'

'.get_the_excerpt().'

'.__("Read More>>","meris").'
'; $j++; endwhile; wp_reset_postdata(); } echo $after_widget; } } /**************************************************************************************/ /** * Home page divider widget */ class meris_home_divider extends WP_Widget { function meris_home_divider() { $widget_ops = array( 'classname' => 'home_widget_divider', 'description' => __( 'Divider for each row.', 'meris' ) ); $control_ops = array( 'width' => 350, 'height' =>250 ); parent::WP_Widget( false, $name = __( 'Meris: Divider', 'meris' ), $widget_ops, $control_ops); } function form( $instance ) { $defaults = array('height' => '10'); $instance = wp_parse_args( (array) $instance, $defaults ); ?>

px

'; echo $after_widget; } } /**************************************************************************************/ /** * Home page slogan widget */ class meris_home_slogan extends WP_Widget { function meris_home_slogan() { $widget_ops = array( 'classname' => 'home_widget_slogan', 'description' => __('slogan widget', 'meris') ); $control_ops = array( 'width' => 350, 'height' =>250 ); parent::WP_Widget( false, $name = __( 'Meris: Slogan', 'meris' ), $widget_ops, $control_ops); } function form( $instance ) { $defaults = array('color' => '#FED136','title'=>'','slogan_content'=>''); $instance = wp_parse_args( (array) $instance, $defaults ); ?>

'.esc_attr( $title ).'

'.do_shortcode(esc_html($slogan_content)).'

'; echo $after_widget; } } /**************************************************************************************/ /** * Home page portfolio widget */ // portfolio structure 1 class meris_home_portfolio_block extends WP_Widget { function meris_home_portfolio_block() { $widget_ops = array( 'classname' => 'home_widget_portfolio', 'description' => __( 'Display pages as portfolio.', 'meris' ) ); $control_ops = array( 'width' => 350, 'height' =>250 ); parent::WP_Widget( false, $name = __( 'Meris: Portfolio', 'meris' ), $widget_ops, $control_ops); } function form( $instance ) { for($i=0;$i<4;$i++){ $defaults['portfolio_'.$i] = ''; } $instance = wp_parse_args( (array) $instance, $defaults ); for($i=0;$i<4;$i++){ ?>

' ','name' => $this->get_field_name( 'portfolio_'.$i ), 'selected' => absint( $instance[ 'portfolio_'.$i] ) ) ); ?>

-1, 'post_type' => array( 'page' ), 'post__in' => $page_array, 'orderby' => 'post__in' ) ); echo $before_widget; $j = 0; $list_num = count($page_array); switch($list_num){ case 1: $column = "12"; break; case 2: $column = "6"; break; case 3: $column = "4"; break; case 4: $column = "3"; break; } if(count($page_array)>0){ while( $get_service_pages->have_posts() ):$get_service_pages->the_post(); $tags = get_the_tags(get_the_ID()); $tags_list = ''; echo '
'; if ( has_post_thumbnail() ) { echo ''; the_post_thumbnail("portfolio"); echo ''; } echo '

'.get_the_title().'

'.$tags_list.'
'; echo '
'; endwhile; wp_reset_postdata(); } echo $after_widget; } } /** * Home page contact form widget */ class meris_home_contact extends WP_Widget { function meris_home_contact() { $widget_ops = array( 'classname' => 'home_widget_contact', 'description' => __( 'Contact form', 'meris' ) ); $control_ops = array( 'width' => 350, 'height' =>250 ); parent::WP_Widget( false, $name = __( 'Meris: Contact Form', 'meris' ), $widget_ops, $control_ops); } function form( $instance ) { $admin_email = get_option( 'admin_email' ); $defaults = array('contact_email' => $admin_email); $instance = wp_parse_args( (array) $instance, $defaults ); ?>

'; echo $after_widget; } } /**************************************************************************************/ /** * Home page title widget */ class meris_home_title extends WP_Widget { function meris_home_title() { $widget_ops = array( 'classname' => 'home_widget_title', 'description' => __( 'Display section title.', 'meris' ) ); $control_ops = array( 'width' => 350, 'height' =>250 ); parent::WP_Widget( false, $name = __( 'Meris: Section Title', 'meris' ), $widget_ops, $control_ops); } function form( $instance ) { $defaults = array('title' => '','sub_title'=>''); $instance = wp_parse_args( (array) $instance, $defaults ); ?>

'.esc_attr( $title ).'

'.esc_attr( $sub_title ).'

'; echo $after_widget; } } /**************************************************************************************/ /** * Sidebar slider. */ class meris_sidebar_slider extends WP_Widget { function meris_sidebar_slider() { $widget_ops = array( 'classname' => 'page_widget_slider', 'description' => __( 'Display some pages as slider.', 'meris' ) ); $control_ops = array( 'width' => 250, 'height' =>250 ); parent::WP_Widget( false, $name = __( 'Meris: Widget Slider', 'meris' ), $widget_ops, $control_ops); } function form( $instance ) { for ( $i=0; $i<6; $i++ ) { $var = 'page_id'.$i; $defaults[$var] = ''; } $instance = wp_parse_args( (array) $instance, $defaults ); for ( $i=0; $i<6; $i++ ) { $var = 'page_id'.$i; $var = absint( $instance[ $var ] ); } ?>

' ','name' => $this->get_field_name( key($defaults) ), 'selected' => absint( $instance[key($defaults)] )) ); ?>

-1, 'post_type' => array( 'page' ), 'post__in' => $page_array, 'orderby' => 'post__in' ) ); echo $before_widget; ?> have_posts() ):$get_featured_pages->the_post(); $page_title = get_the_title(); $active = ''; if($i==0) $active = 'active'; if (has_post_thumbnail( get_the_ID() ) ): $image = wp_get_attachment_image_src( get_post_thumbnail_id( get_the_ID()), 'side-slider' ); $controller .= '
  • '; $images .= '
    '.get_the_title().'
    '; endif; $i++; endwhile; ?>
    'meris_sidebar_social', 'description' => __( 'Display sidebar social network.', 'meris' ) ); $control_ops = array( 'width' => 350, 'height' =>250 ); parent::WP_Widget( false, $name = __( 'Meris: Social Network', 'meris' ), $widget_ops, $control_ops); } function form( $instance ) { $social_icons = array('fa fa-facebook'=>'facebook', 'fa fa-flickr'=>'flickr', 'fa fa-google-plus'=>'google plus', 'fa fa-linkedin'=>'linkedin', 'fa fa-pinterest'=>'pinterest', 'fa fa-twitter'=>'twitter', 'fa fa-tumblr'=>'tumblr', 'fa fa-digg'=>'digg', 'fa fa-rss'=>'rss', ); for($i=0;$i<9;$i++){ $defaults['social_icon_'.$i] = ''; $defaults['social_link_'.$i] = ''; } $instance = wp_parse_args( (array) $instance, $defaults ); for($i=0;$i<9;$i++){ ?>

    '; for($i=0;$i<9; $i++){ $social_icon = esc_attr($instance['social_icon_'.$i]); $social_link = esc_url($instance['social_link_'.$i]); if($social_link !=""){ echo ''; } } echo ''; echo $after_widget; } } /**************************************************************************************/ /** * Popular posts and latest posts tabs */ class meris_post_tabs extends WP_Widget { function meris_post_tabs () { $widget_ops = array( 'classname' => 'home_widget_title', 'description' => __( 'Display popular posts and latest posts tabs.', 'meris' ) ); $control_ops = array( 'width' => 250, 'height' =>250 ); parent::WP_Widget( false, $name = __( 'Meris: Posts Tabs', 'meris' ), $widget_ops, $control_ops); } function form( $instance ) { $defaults = array('popular_num' => '5','recent_num'=>'5'); $instance = wp_parse_args( (array) $instance, $defaults ); ?>

      '; $this->tabs_popular_posts($instance); echo '
      '; $this->tabs_latest_posts($instance); echo '
    '; echo $after_widget; } /*Method to load popular posts*/ function tabs_popular_posts($instance) { extract( $instance ); $popular = new WP_Query('orderby=comment_count&posts_per_page='.absint($popular_num)); while ($popular->have_posts()) : $popular->the_post(); ?>
  •   
  • have_posts()) : $the_query->the_post(); ?>
  •   
  • 'meris-team', 'description' => __( 'Team', 'meris' ) ); $control_ops = array( 'width' => 350, 'height' =>250 ); parent::WP_Widget( false, $name = __( 'Meris: Team', 'meris' ), $widget_ops, $control_ops); } function form( $instance ) { $defaults = array( 'name' => '', 'avatar' => '', 'byline' => '', 'social_icon_1' => '', 'social_link_1' => '', 'social_icon_2' => '', 'social_link_2' => '', 'social_icon_3' => '', 'social_link_3' => '', 'social_icon_4' => '', 'social_link_4' => '', 'short_description' => ''); $instance = wp_parse_args( (array) $instance, $defaults ); ?>

    '.esc_attr($name).'

    '.esc_attr($byline).'
    '; for($i = 1; $i<=4 ; $i++){ if(${"social_icon_".$i} != "" && ${"social_link_".$i} != ""){ echo ''; } } echo '

    '.do_shortcode( esc_textarea($short_description) ).'

    '; echo $after_widget; } } /**************************************************************************************/