term_id;
$cat_meta = get_option("category_$t_id");
?>
|
Sidebar position
|
|
Style category preview
|
|
Style post preview
|
Even block |
|
|
Animation for boxes
|
|
Animation for boxes
|
Odd block |
|
|
Animation for boxes
|
|
Animation for boxes
|
Date icon |
|
|
Animation for boxes
|
|
Animation for boxes
|
ID, 'sidebar_position', true);
$data2 = get_post_meta($post->ID, 'header_skin_custom', true);
$data3 = get_post_meta($post->ID, 'title_line_page', true);
$data4 = get_post_meta($post->ID, 'top_sidebar_show', true);
$data5 = get_post_meta($post->ID, 'brescrumbs_show', true);
// скрытое поле с одноразовым кодом
wp_nonce_field('metatest_action', 'metatest_nonce');
// поле с метаданными
$opt_01 = ( $data == '' ) ? ' selected="selected"' : '';
$opt_02 = ( $data == 'left' ) ? ' selected="selected"' : '';
$opt_03 = ( $data == 'right' ) ? ' selected="selected"' : '';
echo 'Position Sidebar:
'
;
if (($data2 == '') or ($data2 == 'skin1')) { $opt_01 = ' checked="checked"'; } else { $opt_01 = '';}
if ($data2 == 'skin2') { $opt_02 = ' checked="checked"'; } else { $opt_02 = '';}
echo
'
';
if (($data3 == '') or ($data3 == 'yes')) { $opt_01 = ' checked="checked"'; } else { $opt_01 = '';}
if ($data3 == 'no') { $opt_02 = ' checked="checked"'; } else { $opt_02 = '';}
echo
'
';
if (($data4 == '') or ($data4 == 'yes')) { $opt_01 = ' checked="checked"'; } else { $opt_01 = '';}
if ($data4 == 'no') { $opt_02 = ' checked="checked"'; } else { $opt_02 = '';}
echo
'
';
if (($data5 == '') or ($data5 == 'yes')) { $opt_01 = ' checked="checked"'; } else { $opt_01 = '';}
if ($data5 == 'no') { $opt_02 = ' checked="checked"'; } else { $opt_02 = '';}
echo
'
';
}
function metatest_save($postID) {
// пришло ли поле наших данных?
//if (!isset($_POST['sidebar_position']))
//return;
// не происходит ли автосохранение?
if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE)
return;
// не ревизию ли сохраняем?
if (wp_is_post_revision($postID))
return;
// проверка достоверности запроса
//check_admin_referer('metatest_action', 'metatest_nonce');
// коррекция данных
$data = sanitize_text_field($_POST['sidebar_position']);
$data2 = sanitize_text_field($_POST['header_skin_custom']);
$data3 = sanitize_text_field($_POST['title_line_page']);
$data4 = sanitize_text_field($_POST['top_sidebar_show']);
$data5 = sanitize_text_field($_POST['brescrumbs_show']);
// запись
update_post_meta($postID, 'sidebar_position', $data);
update_post_meta($postID, 'header_skin_custom', $data2);
update_post_meta($postID, 'title_line_page', $data3);
update_post_meta($postID, 'top_sidebar_show', $data4);
update_post_meta($postID, 'brescrumbs_show', $data5);
}