homepage = "Homepage"; $this->shorthomepage = ""; $frst_post_wordpress=''; $post_in_array=get_posts( array('posts_per_page' => 1)); if($post_in_array) $frst_post_wordpress=$post_in_array[0]->ID; unset($post_in_array); $value_of_std[0]=get_theme_mod($this->shorthomepage."_hide_slider",'on'); $value_of_std[1]=get_theme_mod($this->shorthomepage."_top_post_cat_name",''); $value_of_std[2]=get_theme_mod($this->shorthomepage."_hide_top_posts",'on'); $value_of_std[3]=get_theme_mod($this->shorthomepage."_top_post_categories",''); $value_of_std[4]=get_theme_mod($this->shorthomepage."_hide_category_tabs_posts",'on'); $value_of_std[5]=get_theme_mod($this->shorthomepage."_home_page_tabs_exclusive",'{"1":"random","2":"popular","3":"recent"}'); $value_of_std[6]=get_theme_mod($this->shorthomepage."_hide_video_post",'on'); $value_of_std[7]=get_theme_mod($this->shorthomepage."_home_video_post",$frst_post_wordpress); /*$value_of_std[8]=get_theme_mod($this->shorthomepage."_n_of_home_post",'');*/ $value_of_std[9]=get_theme_mod($this->shorthomepage."_content_post_cat_name",''); $value_of_std[10]=get_theme_mod($this->shorthomepage."_hide_content_posts",'on'); $value_of_std[11]=get_theme_mod($this->shorthomepage."_content_post_categories",''); $value_of_std[12]=get_theme_mod($this->shorthomepage."_video_post_name",'MOST POPULIAR'); $this->options_homepage = array( "hide_slider" => array( "name" => "Slider", "description" => "Check the box to display the homepage slider.", "var_name" => "hide_slider", "id" => $this->shorthomepage."_hide_slider", "std" => $value_of_std[0] ), "top_post_cat_name" => array( "name" => "", "description" => "Name of top post category", "var_name" => "top_post_cat_name", "id" => $this->shorthomepage."_top_post_cat_name", "std" => $value_of_std[1] ), "hide_top_posts" => array( "name" => "Top Posts", "description" => "Check the box to display the top posts from the homepage.", "var_name" => "hide_top_posts", "id" => $this->shorthomepage."_hide_top_posts", "std" => $value_of_std[2] ), "top_post_categories" => array( "name" => "Top Posts", "description" => "Select the categories from which you want the homepage top posts to be selected (the posts are selected automatically).", "var_name" => "top_post_categories", "id" => $this->shorthomepage."_top_post_categories", "std" => $value_of_std[3] ), "hide_category_tabs_posts" => array( "name" => "Category Tabs", "description" => "Check the box to display the category tabs from the homepage.", "var_name" => "hide_category_tabs_posts", "id" => $this->shorthomepage."_hide_category_tabs_posts", "std" => $value_of_std[4] ), "home_page_tabs_exclusive" => array( "name" => "Hide Slider", "description" => "", "var_name" => "home_page_tabs_exclusive", "id" => $this->shorthomepage."_home_page_tabs_exclusive", "std" => $value_of_std[5] ), "hide_video_post" => array( "name" => "Video Post", "description" => "Check the box to display the video-related post from the homepage.", "var_name" => "hide_video_post", "id" => $this->shorthomepage."_hide_video_post", "std" => $value_of_std[6] ), "home_video_post" => array( "name" => "Video post.....", "all_values" => $this->get_all_posts_in_select(), "description" => "Select post for displaying in video us page", "var_name" => "home_video_post", "id" => $this->shorthomepage."_home_video_post", "std" => $value_of_std[7] ), /*"n_of_home_post" => array( "name" => "", "description" => "Specify the number of content posts which will be displayed in the homepage.", "var_name" => "n_of_home_post", "id" => $this->shorthomepage."_n_of_home_post", "std" => $value_of_std[8] ),*/ "content_post_cat_name" => array( "name" => "", "description" => "Name of top post category", "var_name" => "content_post_cat_name", "id" => $this->shorthomepage."_content_post_cat_name", "std" => $value_of_std[9] ), "hide_content_posts" => array( "name" => "Content Top Posts", "description" => "Check the box to select the categories from which top posts will be displayed.", "var_name" => "hide_content_posts", "id" => $this->shorthomepage."_hide_content_posts", "std" => $value_of_std[10] ), "content_post_categories" => array( "name" => "", "description" => "Select the categories.", "var_name" => "content_post_categories", "id" => $this->shorthomepage."_content_post_categories", "std" => $value_of_std[11] ), "video_post_name" => array( "name" => "", "description" => "Name of video post", "var_name" => "video_post_name", "id" => $this->shorthomepage."_video_post_name", "std" => $value_of_std[12] ), ); } /// save changes or reset options public function web_dorado_theme_update_and_get_options_home(){ if (isset($_GET['page']) && $_GET['page'] == "web_dorado_theme" && isset($_GET['controller']) && $_GET['controller'] == "home_page") { if (isset($_REQUEST['action']) && $_REQUEST['action']=='save' ) { foreach ($this->options_homepage as $value) { if(isset($_REQUEST[$value['var_name']])) set_theme_mod($value['id'], stripslashes($_REQUEST[$value['var_name']])); } foreach ($this->options_homepage as $value) { if (isset($_REQUEST[$value['var_name']])) { set_theme_mod($value['id'], stripslashes($_REQUEST[$value['var_name']])); } else { remove_theme_mod($value['id']); } } header("Location: themes.php?page=web_dorado_theme&controller=home_page&saved=true"); die; } else { if (isset($_REQUEST['action']) && $_REQUEST['action']=='reset') { foreach ($this->options_homepage as $value) { remove_theme_mod($value['id']); } header("Location: themes.php?page=web_dorado_theme&controller=home_page&reset=true"); die; } } } } public function web_dorado_home_page_admin_scripts(){ wp_enqueue_style('home_page_main_style',get_template_directory_uri().'/admin/css/home_page.css'); } public function update_parametr($param_name,$value){ if(isset($this->options_homepage[$param_name]['id'])) set_theme_mod($this->options_homepage[$param_name]['id'],$value); } private function get_all_posts_in_select(){ $args= array( 'posts_per_page' => 3000, 'orderby' => 'post_date', 'order' => 'DESC', 'post_type' => 'post', 'post_status' => 'publish', ); $posts_array_custom=array(); $posts_array = get_posts( $args ); foreach($posts_array as $post){ $posts_array_custom[$post->ID]=$post->post_title; } return $posts_array_custom; } public function dorado_theme_admin_home(){ if (isset($_REQUEST['saved']) && $_REQUEST['saved'] ) echo '

Home settings are saved.

'; if (isset($_REQUEST['reset']) && $_REQUEST['reset'] ) echo '

Home settings are reset.

'; global $best_magazine_admin_helepr_functions,$best_magazine_web_dor; ?>
User Manual
This section allows you to customize the homepage. More...

Home

only_checkbox($this->options_homepage['hide_slider']); $best_magazine_admin_helepr_functions->checkbox_category_checkboxses($this->options_homepage['hide_top_posts'],$this->options_homepage['top_post_categories'],$this->options_homepage['top_post_cat_name']); /// Home Top posts $best_magazine_admin_helepr_functions->category_select_with_checkboxse($this->options_homepage['hide_category_tabs_posts'],$this->options_homepage['home_page_tabs_exclusive']); /// Home Top posts $best_magazine_admin_helepr_functions->checkbox_with_select($this->options_homepage['hide_video_post'],$this->options_homepage['home_video_post'],$this->options_homepage['video_post_name']); /// Home Number of posts $best_magazine_admin_helepr_functions->checkbox_category_checkboxses($this->options_homepage['hide_content_posts'],$this->options_homepage['content_post_categories'],array($this->options_homepage['content_post_cat_name'])); /// Home Top posts ?>