...
if(update_field( 'post_status', 2, $postID ) && update_field( 'post_date', $postDate, $postID ) && update_field( 'post_time', $postTime, $postID )){
echo(json_encode( array('pinned'=>'success', '$postID'=>$postID) ));
}else{
echo(json_encode( array('pinned'=>'failure', '$postID'=>$postID) ));
}
...
...
success: function (response) {
if ("success" == response.pinned) {
console.log('Pin master response : success');
} else {
console.log('Pin master response : failure');
}
},
error: function (response) {
console.log('Error master response : ' , response);
}
...
// Вместо этого хука
/*
add_action('comment_form_after_fields', "recaptchadiv");
function recaptchadiv($post_id) {
global $user_ID;
$recaptcha_site_key = 'Ключ';
if ($user_ID) {
return $post_id;
}
echo '<div class="g-recaptcha" data-sitekey="'.$recaptcha_site_key.'"></div>';
return $post_id;
}*/
// Вставьте этот
add_filter('comment_form_submit_button', 'filter_comment_form_submit_button', 10, 2);
function filter_comment_form_submit_button($submit_button) {
$recaptcha_site_key = 'Ключ';
echo '<div class="g-recaptcha" data-sitekey="'.$recaptcha_site_key.'"></div>';
$submit_before = '<div class="form-group">';
$submit_after = '</div>';
return $submit_before . $submit_button . $submit_after;
}
// В последнем хуке удалите проверку юзера, получится так
add_action('preprocess_comment', "preprocess_comment_cb");
function preprocess_comment_cb($commentdata) {
if ( ! verify_recaptcha_response() ) {
echo '<p style="font-size: 1rem;">You are not verified reCaptcha test. Return to the <a href="#"
onclick="history.go(-1);">previous page </a> and try again.';
exit;
}
return $commentdata;
}
$(".reg-btn").click(function(e){
e.preventDefault();
var data_block = $(this).data("block");
if($(this).hasClass("active")){
$(document).find(data_block).slideUp();
$(this).removeClass("active");
} else {
$(this).addClass('active');
}
$(".block-of-text").toggle(false);
$(data_block).toggle(true);
});