ID, 'business_world_meta_date', TRUE); $n_of_home_post=get_option( 'posts_per_page', 6 ); if( gettype ($post->ID) == 'integer' ){ $meta=array( 'layout' => $business_world_layout_page->options_themeoptions['default_layout']['std'] , 'content_width' => $business_world_layout_page->options_themeoptions['content_area']['std'] , 'main_col_width' => $business_world_layout_page->options_themeoptions['main_column']['std'] , 'pr_widget_area_width' => $business_world_layout_page->options_themeoptions['pwa_width']['std'], 'fullwidthpage' => $business_world_layout_page->options_themeoptions['full_width']['std'], 'single_post_text' => '', 'blogstyle' => '', 'showthumb' => '', 'blog_perpage' =>$n_of_home_post, 'showtitle' => '', 'showdesc' => '', 'detect_portrait' => '', 'thumbsize' => '2', 'static_pages_on' => '', 'all_categories_on' => '', 'tags_on' => '', 'archives_on' => '', 'authors_on' => '', 'blog_posts_on' => '', 'category_tabs_mst_pop'=> '', 'categories'=>'', 'hide_category_tabs_mst_pop'=>'' ); } else { $meta_if_par_not_initilas=array( 'layout' => $business_world_layout_page->options_themeoptions['default_layout']['std'] , 'content_width' => $business_world_layout_page->options_themeoptions['content_area']['std'] , 'main_col_width' => $business_world_layout_page->options_themeoptions['main_column']['std'] , 'pr_widget_area_width' => $business_world_layout_page->options_themeoptions['pwa_width']['std'], 'fullwidthpage' => $business_world_layout_page->options_themeoptions['full_width']['std'], 'single_post_text' => '', 'blogstyle' => '', 'showthumb' => '', 'blog_perpage' => $n_of_home_post, 'showtitle' => '', 'showdesc' => '', 'detect_portrait' => '', 'thumbsize' => '2', 'static_pages_on' => '', 'all_categories_on' => '', 'tags_on' => '', 'archives_on' => '', 'authors_on' => '', 'blog_posts_on' => '', 'category_tabs_mst_pop'=> '', 'categories'=>'', 'hide_category_tabs_mst_pop'=>'' ); foreach($meta_if_par_not_initilas as $key=>$meta_if_par_not_initila){ if(!isset($meta[$key])){ $meta[$key]=$meta_if_par_not_initila; } } } // instead of writing HTML here, lets do an include require_once('meta.php'); // create a custom nonce for submit verification later echo ''; } function business_world_meta_save($post_id) { // authentication checks // check user permissions if (isset($_POST['post_type']) && $_POST['post_type'] == 'page') { if (!current_user_can('edit_page', $post_id)) return $post_id; } else { if (!current_user_can('edit_post', $post_id)) return $post_id; } $current_data = get_post_meta($post_id, 'business_world_meta_date', TRUE); if(isset($_POST['business_world_meta_date'])) $new_data = $_POST['business_world_meta_date']; else $new_data = ''; //business_world_meta_clean($new_data); if (gettype ($post_id) == 'integer') { if(is_null($new_data)){ delete_post_meta($post_id, 'business_world_meta_date'); } else{ update_post_meta($post_id, 'business_world_meta_date', $new_data); add_post_meta($post_id, 'business_world_meta_date', $new_data, TRUE); } } elseif (!is_null($new_data)) { update_post_meta($post_id, 'business_world_meta_date', $new_data); } return $post_id; } function business_world_meta_clean(&$arr) { if (is_array($arr)) { foreach ($arr as $i => $v) { if (is_array($arr[$i])) { business_world_meta_clean($arr[$i]); if (!count($arr[$i])) { unset($arr[$i]); } } else { if (trim($arr[$i]) == '') { unset($arr[$i]); } } } if (!count($arr)) { $arr = NULL; } } }