Function Reference: geodir_set_default_widgets
Summary
Set sidebar widgets.
Package
GeoDirectory
Change Log
Since: 1.0.0
Source File
geodir_set_default_widgets() is located in geodirectory-admin/admin_install.php [Line: 199]
Source Code
function geodir_set_default_widgets() { $widget_option_list = array(); $widgetinfo = array(); $sidebarvalue_array = array(); $sidebars_widgets = array(); /*===========================*/ /* Widgets ON HOME PAGE */ /*===========================*/ $widget_option_list['geodir_home_top'] = array('popular_post_category' => array("title" => __('Popular Categories', 'geodirectory')), 'geodir_map_v3_home_map' => array("autozoom" => 1, "width" => '100%', "heigh" => '425'), 'geodir_advance_search' => array()); $widget_option_list['geodir_home_content'] = array('popular_post_view' => array("title" => __('Popular Places', 'geodirectory'), "layout" => 'list', "add_location_filter" => '1')); $widget_option_list['geodir_home_right'] = array('geodir_loginbox' => array("title" => __('My Dashboard', 'geodirectory')), 'popular_post_view' => array("title" => __('Latest Places', 'geodirectory'), "add_location_filter" => '1')); /*===========================*/ /* Widgets ON LISTING PAGE */ /*===========================*/ $widget_option_list['geodir_listing_top'] = array('popular_post_category' => array("title" => __('Popular Categories', 'geodirectory')), 'geodir_advance_search' => array()); $widget_option_list['geodir_listing_right_sidebar'] = array('geodir_loginbox' => array("title" => __('My Dashboard', 'geodirectory')), 'geodir_map_v3_listing_map' => array("autozoom" => 1, "sticky" => 1), 'popular_post_view' => array("title" => __('Latest Places', 'geodirectory'), "add_location_filter" => '1')); /*===========================*/ /* Widgets ON SEARCH PAGE */ /*===========================*/ $widget_option_list['geodir_search_top'] = array('popular_post_category' => array("title" => __('Popular Categories', 'geodirectory')), 'geodir_advance_search' => array()); $widget_option_list['geodir_search_right_sidebar'] = array('geodir_loginbox' => array("title" => __('My Dashboard', 'geodirectory')), 'geodir_map_v3_listing_map' => array("autozoom" => 1, "sticky" => 1), 'popular_post_view' => array("title" => __('Latest Places', 'geodirectory'), "add_location_filter" => '1')); /*===========================*/ /* Widgets ON DETAIL/SINGLE PAGE */ /*===========================*/ $widget_option_list['geodir_detail_sidebar'] = array('geodir_loginbox' => array("title" => __('My Dashboard', 'geodirectory')), 'geodir_map_v3_listing_map' => array("autozoom" => 1, "sticky" => 1), 'popular_post_view' => array("title" => __('Latest Places', 'geodirectory'), "add_location_filter" => '1')); /*===========================*/ /* Widgets ON AUTHOR PAGE */ /*===========================*/ $widget_option_list['geodir_author_right_sidebar'] = array('geodir_loginbox' => array("title" => __('My Dashboard', 'geodirectory'))); $sidebars_widgets = get_option('sidebars_widgets'); foreach ($widget_option_list as $key => $widget_options) { foreach ($widget_options as $key2 => $widget_options_obj) { $widgetid = 'widget_' . $key2; $widgetinfo[$widgetid][] = $widget_options_obj; $sidebarvalue_array[$key][] = $key2 . "-" . (count($widgetinfo[$widgetid])); $widget_update[$widgetid][count($widgetinfo[$widgetid])] = $widget_options_obj; } if (!empty($sidebarvalue_array[$key])) { $sidebars_widgets = get_option('sidebars_widgets'); $sidebars_widgets[$key] = $sidebarvalue_array[$key]; update_option('sidebars_widgets', $sidebars_widgets); foreach ($widget_update as $key => $value) { update_option($key, $value); } } } }