add_filter('nav_menu_css_class', 'normalize_wp_classes', 10, 2);
add_filter('page_css_class', 'normalize_wp_classes', 10, 2);
function normalize_wp_classes(array $classes, $item = null){
$replacements = array(
'current-menu-item',
'current-menu-parent',
'current-menu-ancestor',
'current_page_item',
'current_page_parent',
'current_page_ancestor',
);
return array_intersect($replacements, $classes) ? array('active') : array();
}
#menu .current-menu-item > a,#menu .current-menu-ancestor > a,#menu .current_page_item > a,#menu .current_page_ancestor > a{
-moz-box-shadow:0px 2px 0px rgba(0,0,0,1);
-webkit-box-shadow:0px 2px 0px rgba(0,0,0,1);
box-shadow:0px 2px 0px rgba(0,0,0,1);
}
add_action('add_meta_boxes','VAB_short_for_posts_meta_box');
if(!function_exists('VAB_short_for_posts_meta_box')){
function VAB_short_for_posts_meta_box(){
$screens=array('post');
add_meta_box('post_meta',__('Лайки поста','VAB'),'post_meta_box_callback',$screens,'side','high');
}
}
if(!function_exists('post_meta_box_callback')){
function post_meta_box_callback($post,$meta){
$screens=$meta['args'];
$post_meta=get_post_meta($post->ID,'_recommended');
echo __('<label for="_recommended"><input id="_recommended" size="4" type="text" name="_recommended" value="'.$post_meta[0].'"></label>';
}
}
add_action('edit_post','VAB_update_post_meta',10,2);
function VAB_update_post_meta($post_ID,$post){
//создание метабокса
add_action('add_meta_boxes','nivo_meta_box');
function nivo_meta_box(){
$screens=array('vabmegaslider');
add_meta_box('nivo_meta',__('Слайдер «Nivo»','VAB'),'nivo_meta_box_callback',$screens,'side','low');}
function nivo_meta_box_callback($post,$meta){
wp_nonce_field('VAB_mode_slider_nonce','VAB_slider_nonce');//вот оно
.....
//обновление поста и вместе с ним мета поля с проверками
add_action('edit_post','VAB_update_post_meta',10,2);
function VAB_update_post_meta($post_ID,$post){
$nonce=filter_input(INPUT_POST,'VAB_slider_nonce',FILTER_SANITIZE_STRING);
if(!$nonce){return $post_ID;}
if(!wp_verify_nonce($nonce,'VAB_mode_slider_nonce')){return;}
if(defined('DOING_AUTOSAVE')&&DOING_AUTOSAVE){return;}
if(!current_user_can('edit_post',$post_ID)){return;}
$post_type=get_post_type($post_ID);
....
global $wpdb;
if (!is_numeric($post_id)) return;
$text_zero_suffix = sanitize_text_field($text_zero_suffix);
$text_one_suffix = sanitize_text_field($text_one_suffix);
$text_more_suffix = sanitize_text_field($text_more_suffix);
switch ($action) {
case 'get':
$recommended = get_post_meta($post_id, '_recommended', true);
if (!$recommended) {
$recommended = 0;
add_post_meta($post_id, '_recommended', $recommended, true);
}
$post_meta=get_post_meta($thepostid,'_recommended');
echo $post_meta[0];
$post_meta=get_post_meta('77','_recommended');
echo $post_meta[0];
$(document).pjax('[go_pjax] a','#CenteBig,#wp-calendar',{fragment:'#CenteBig,#wp-calendar',timeout:44444,scrollTo:No_Yes_scroll_To,push:true});
на всякий пожарный