JoeHana
1/30/2014 - 11:29 PM

wpCasa: Add custom widget area

wpCasa: Add custom widget area

<?php

/**
 * Add custom widget area
 */
 
add_filter('wpsight_widget_areas', 'custom_widget_areas', 100);
 
function custom_widget_areas($wpsight_widget_areas) {

	$wpsight_widget_areas = array(
	
		'sidebar' => array(
			'name' 		=> __( 'General Sidebar', 'wpsight' ),
			'description' 	=> __( 'This is the primary sidebar to display the same widgets on all pages.', 'wpsight' ),
			'id' 		=> 'sidebar',
			'before_widget' => '<div id="%1$s" class="widget %2$s"><div class="widget-inner">',
			'after_widget' 	=> '</div></div>',
			'before_title' 	=> '<h4 class="title">',
			'after_title' 	=> '</h4>',
			'position'	=> 10
		),
		
		'sidebar-archive' => array(
			'name'		=> __( 'Archive Sidebar', 'wpsight' ),
			'description' 	=> __( 'This is the sidebar on category, tag, author, date and search pages. If empty, archives will be displayed without sidebar.', 'wpsight' ),
			'id' 		=> 'sidebar-archive',
			'before_widget' => '<div id="%1$s" class="widget %2$s"><div class="widget-inner">',
			'after_widget' 	=> '</div></div>',
			'before_title' 	=> '<h4 class="title">',
			'after_title' 	=> '</h4>',
			'position'	=> 20
		),
		
		'sidebar-post' => array(
			'name' 		=> __( 'Post Sidebar', 'wpsight' ),
			'description' 	=> __( 'This is the sidebar on single post pages. If empty, posts will be displayed without sidebar.', 'wpsight' ),
			'id' 		=> 'sidebar-post',
			'before_widget' => '<div id="%1$s" class="widget %2$s"><div class="widget-inner">',
			'after_widget' 	=> '</div></div>',
			'before_title' 	=> '<h4 class="title">',
			'after_title' 	=> '</h4>',
			'position'	=> 30
		),
		
		'sidebar-page' => array(
			'name' 		=> __( 'Page Sidebar', 'wpsight' ),
			'description' 	=> __( 'This is the sidebar on static pages. If empty, pages will be displayed without sidebar.', 'wpsight' ),
			'id' 		=> 'sidebar-page',
			'before_widget' => '<div id="%1$s" class="widget %2$s"><div class="widget-inner">',
			'after_widget' 	=> '</div></div>',
			'before_title' 	=> '<h4 class="title">',
			'after_title' 	=> '</h4>',
			'position'	=> 40
		),
		
		'home-top' => array(
			'name' 		=> __( 'Home Page Top', 'wpsight' ),
			'description' 	=> __( 'Top Content on the home page', 'wpsight' ),
			'id' 		=> 'home-top',
			'before_widget' => '<div id="%1$s" class="widget %2$s"><div class="widget-inner">',
			'after_widget' 	=> '</div></div>',
			'before_title' 	=> '<h4 class="title">',
			'after_title' 	=> '</h4>',
			'position'	=> 50
		),
		
		'home' => array(
			'name' 		=> __( 'Home Page Content', 'wpsight' ),
			'description' 	=> __( 'Main Content on the home page', 'wpsight' ),
			'id' 		=> 'home',
			'before_widget' => '<div id="%1$s" class="widget %2$s"><div class="widget-inner">',
			'after_widget' 	=> '</div></div>',
			'before_title' 	=> '<h4 class="title">',
			'after_title' 	=> '</h4>',
			'position'	=> 60
		),
		
		'sidebar-home' => array(
			'name' 		=> __( 'Home Page Sidebar', 'wpsight' ),
			'description' 	=> __( 'The sidebar on the home page', 'wpsight' ),
			'id' 		=> 'sidebar-home',
			'before_widget' => '<div id="%1$s" class="widget %2$s"><div class="widget-inner">',
			'after_widget' 	=> '</div></div>',
			'before_title' 	=> '<h4 class="title">',
			'after_title' 	=> '</h4>',
			'position'	=> 70
		),
		
		'home-bottom' => array(
			'name' 		=> __( 'Home Page Bottom', 'wpsight' ),
			'description' 	=> __( 'Bottom Content on the home page', 'wpsight' ),
			'id' 		=> 'home-bottom',
			'before_widget' => '<div id="%1$s" class="widget %2$s"><div class="widget-inner">',
			'after_widget' 	=> '</div></div>',
			'before_title' 	=> '<h4 class="title">',
			'after_title' 	=> '</h4>',
			'position'	=> 80
		),
		
		'listing' => array(
			'name' 		=> __( 'Listing Single Content', 'wpsight' ),
			'description' 	=> __( 'Main content on single listing pages', 'wpsight' ),
			'id' 		=> 'listing',
			'before_widget' => '<div id="%1$s" class="widget %2$s"><div class="widget-inner">',
			'after_widget' 	=> '</div></div>',
			'before_title' 	=> '<h3 class="title">',
			'after_title' 	=> '</h3>',
			'position'	=> 85
		),
		
		'sidebar-listing' => array(
			'name' 		=> __( 'Listing Single Sidebar', 'wpsight' ),
			'description'	=> __( 'Sidebar on single listing pages', 'wpsight' ),
			'id' 		=> 'sidebar-listing',
			'before_widget' => '<div id="%1$s" class="widget %2$s"><div class="widget-inner">',
			'after_widget' 	=> '</div></div>',
			'before_title' 	=> '<h4 class="title">',
			'after_title' 	=> '</h4>',
			'position'	=> 86
		),
		
		'sidebar-listing-archive' => array(
			'name' 		=> __( 'Listing Archive Sidebar', 'wpsight' ),
			'description' 	=> __( 'Sidebar on listing archive pages', 'wpsight' ),
			'id' 		=> 'sidebar-listing-archive',
			'before_widget' => '<div id="%1$s" class="widget %2$s"><div class="widget-inner">',
			'after_widget' 	=> '</div></div>',
			'before_title' 	=> '<h4 class="title">',
			'after_title' 	=> '</h4>',
			'position'	=> 87
		),
		
		'footer' => array(
			'name' 		=> __( 'Footer', 'wpsight' ),
			'description' 	=> __( 'Footer widget area', 'wpsight' ),
			'id' 		=> 'ffooter',
			'before_widget' => '<div id="%1$s" class="widget %2$s"><div class="widget-inner">',
			'after_widget' 	=> '</div></div>',
			'before_title' 	=> '<h4 class="title">',
			'after_title' 	=> '</h4>',
			'position'	=> 90
		),
	
		'custom-position' => array(
			'name' 		=> __( 'Custom Position', 'wpsight' ),
			'description' 	=> __( '', 'wpsight' ),
			'id' 		=> 'custom-position',
			'before_widget' => '<div id="%1$s" class="widget %2$s"><div class="widget-inner">',
			'after_widget' 	=> '</div></div>',
			'before_title' 	=> '<h4 class="title">',
			'after_title' 	=> '</h4>',
			'position'	=> 100
		)
	
	);
	
	// Sort array by position        
    	$wpsight_widget_areas = wpsight_sort_array_by_position( $wpsight_widget_areas );

	return $wpsight_widget_areas;
 
}