__('Primary Sidebar', 'backyard'), 'id'=>'sidebar-primary')); global $backyard; if(isset($backyard['cust_sidebars'])) { if (is_array($backyard['cust_sidebars'])) { $i = 1; foreach($backyard['cust_sidebars'] as $sidebar){ if(empty($sidebar)) {$sidebar = 'sidebar'.$i;} $all_sidebars[]=array('name'=>$sidebar, 'id'=>'sidebar'.$i); $i++; } } } global $vir_sidebars; $vir_sidebars = $all_sidebars; return $all_sidebars; } add_action('init', 'backyard_sidebar_list'); function backyard_register_sidebars(){ $the_sidebars = backyard_sidebar_list(); if (function_exists('register_sidebar')){ foreach($the_sidebars as $side){ backyard_register_sidebar($side['name'], $side['id']); } } } function backyard_register_sidebar($name, $id){ register_sidebar(array('name'=>$name, 'id' => $id, 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', )); } add_action('widgets_init', 'backyard_register_sidebars'); function backyard_widgets_init() { //Topbar register_sidebar(array( 'name' => __('Topbar Widget', 'backyard'), 'id' => 'topbarright', 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', )); // Sidebars register_sidebar(array( 'name'=> __('Primary Sidebar', 'backyard'), 'id'=> 'sidebar-primary', 'before_widget'=> '', 'before_title'=> '

', 'after_title'=> '

', )); // Footer global $footer_widgets_layout; if(get_theme_mod('footer_widgets_layout')) { $footer_widgets_layout=get_theme_mod('footer_widgets_layout'); } if ($footer_widgets_layout == "fourc") { if ( function_exists('register_sidebar') ) register_sidebar(array( 'name' => __('Footer Column One', 'backyard'), 'id' => 'footer_1', 'before_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); if ( function_exists('register_sidebar') ) register_sidebar(array( 'name' => __('Footer Column Two', 'backyard'), 'id' => 'footer_2', 'before_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); if ( function_exists('register_sidebar') ) register_sidebar(array( 'name' => __('Footer Column Three', 'backyard'), 'id' => 'footer_3', 'before_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); if ( function_exists('register_sidebar') ) register_sidebar(array( 'name' => __('Footer Column Four', 'backyard'), 'id' => 'footer_4', 'before_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); } else if ($footer_widgets_layout == "threec") { if ( function_exists('register_sidebar') ) register_sidebar(array( 'name' => __('Footer Column One', 'backyard'), 'id' => 'footer_third_1', 'before_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); if ( function_exists('register_sidebar') ) register_sidebar(array( 'name' => __('Footer Column Two', 'backyard'), 'id' => 'footer_third_2', 'before_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); if ( function_exists('register_sidebar') ) register_sidebar(array( 'name' => __('Footer Column Three', 'backyard'), 'id' => 'footer_third_3', 'before_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); } else if ($footer_widgets_layout == "twoc") { if ( function_exists('register_sidebar') ) register_sidebar(array( 'name' => __('Footer Column One', 'backyard'), 'id' => 'footer_two_1', 'before_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); if ( function_exists('register_sidebar') ) register_sidebar(array( 'name' => __('Footer Column Two', 'backyard'), 'id' => 'footer_two_2', 'before_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); }else { if ( function_exists('register_sidebar') ) register_sidebar(array( 'name' => __('Footer Column', 'backyard'), 'id' => 'footer_onecol_1', 'before_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); } // Widgets register_widget('Backyard_Social_Widget'); register_widget('Backyard_Recent_Posts_Widget'); register_widget('Backyard_Popular_Posts_Widget'); register_widget('About_With_Image'); } add_action('widgets_init', 'backyard_widgets_init'); /** * Social widget */ class Backyard_Social_Widget extends WP_Widget { private static $instance = 0; public function __construct() { $widget_ops = array('classname' => 'widget_backyard_social', 'description' => __('Simple way to add Social Icons', 'backyard')); parent::__construct('widget_backyard_social', __('Backyard: Social Links', 'backyard'), $widget_ops); } function widget($args, $instance) { if (!isset($args['widget_id'])) { $args['widget_id'] = null; } if (isset($cache[$args['widget_id']])) { echo $cache[$args['widget_id']]; return; } ob_start(); extract($args); $title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base); if (!isset($instance['facebook'])) { $instance['facebook'] = ''; } if (!isset($instance['twitter'])) { $instance['twitter'] = ''; } if (!isset($instance['instagram'])) { $instance['instagram'] = ''; } if (!isset($instance['googleplus'])) { $instance['googleplus'] = ''; } if (!isset($instance['flickr'])) { $instance['flickr'] = ''; } if (!isset($instance['vimeo'])) { $instance['vimeo'] = ''; } if (!isset($instance['youtube'])) { $instance['youtube'] = ''; } if (!isset($instance['pinterest'])) { $instance['pinterest'] = ''; } if (!isset($instance['dribbble'])) { $instance['dribbble'] = ''; } if (!isset($instance['linkedin'])) { $instance['linkedin'] = ''; } if (!isset($instance['tumblr'])) { $instance['tumblr'] = ''; } if (!isset($instance['vk'])) { $instance['vk'] = ''; } if (!isset($instance['rss'])) { $instance['rss'] = ''; } echo $before_widget; if ($title) { echo $before_title; echo $title; echo $after_title; } ?>

'backyard_popular_posts', 'description' => __('This shows the most popular posts on your site with a thumbnail', 'backyard')); parent::__construct('backyard_popular_posts', __('Backyard: Popular Posts', 'backyard'), $widget_ops); } function widget($args, $instance) { if ( ! isset( $args['widget_id'] ) ) $args['widget_id'] = $this->id; if ( isset( $cache[ $args['widget_id'] ] ) ) { echo $cache[ $args['widget_id'] ]; return; } ob_start(); extract($args); $title = apply_filters('widget_title', empty($instance['title']) ? __('Popular Posts', 'backyard') : $instance['title'], $instance, $this->id_base); if ( empty( $instance['number'] ) || ! $number = absint( $instance['number'] ) ) $number = 10; $popular_posts = new WP_Query(apply_filters( 'widget_posts_args', array( 'posts_per_page' => $number, 'category_name' => $instance['thecate'], 'no_found_rows' => true, 'post_status' => 'publish', 'ignore_sticky_posts' => true,'meta_key' => 'wpb_post_views_count', 'orderby' => 'meta_value_num', 'order' => 'DESC') ) ); if ($popular_posts->have_posts()) : ?> have_posts()) : $popular_posts->the_post(); ?>
ID ) ) { echo ''; the_post_thumbnail( 'popular-thumb' ); echo ''; } else { $image_url = backyard_post_widget_default_placeholder(); $image = aq_resize($image_url, 257, 151, true); if(empty($image)) { $image = $image_url; } echo ''; } ?>

All'; foreach ($categories as $cate) { if ($thecate==$cate->slug) { $selected=' selected="selected"';} else { $selected=""; } $cate_options[] = ''; } ?>

'backyard_recent_posts', 'description' => __('This shows the most recent posts on your site with a thumbnail', 'backyard')); parent::__construct('backyard_recent_posts', __('Backyard: Recent Posts', 'backyard'), $widget_ops); } function widget($args, $instance) { if ( ! isset( $args['widget_id'] ) ) $args['widget_id'] = $this->id; if ( isset( $cache[ $args['widget_id'] ] ) ) { echo $cache[ $args['widget_id'] ]; return; } ob_start(); extract($args); $title = apply_filters('widget_title', empty($instance['title']) ? __('Recent Posts', 'backyard') : $instance['title'], $instance, $this->id_base); if ( empty( $instance['number'] ) || ! $number = absint( $instance['number'] ) ) $number = 10; $recent_posts = new WP_Query( apply_filters( 'widget_posts_args', array( 'posts_per_page' => $number, 'category_name' => $instance['thecate'], 'no_found_rows' => true, 'post_status' => 'publish', 'ignore_sticky_posts' => true ) ) ); if ($recent_posts->have_posts()) : ?> have_posts()) : $recent_posts->the_post(); ?>
ID ) ) { echo ''; the_post_thumbnail( 'widget-thumb' ); echo ''; } else { $image_url = backyard_post_widget_default_placeholder(); $image = aq_resize($image_url, 54, 47, true); if(empty($image)) { $image = $image_url; } echo ''; } ?>

All'; foreach ($categories as $cate) { if ($thecate==$cate->slug) { $selected=' selected="selected"';} else { $selected=""; } $cate_options[] = ''; } ?>

'backyard_about_with_image', 'description' => __('This allows for an image and a simple about text.', 'backyard')); parent::__construct('backyard_about_with_image', __('Backyard: About With Image', 'backyard'), $widget_ops); } public function widget($args, $instance){ extract( $args ); if(!empty($instance['more_about_me_link'])) {$more_about_me_link = $instance['more_about_me_link'];} else {$more_about_me_link = '#';} ?>

MORE ABOUT ME