This commit is contained in:
Roman Pyrih
2025-10-01 14:19:10 +02:00
parent f7e757d188
commit a63e42a362
6 changed files with 393 additions and 36 deletions

View File

@@ -239,3 +239,21 @@ add_filter('wpcf7_form_elements', function($content) {
);
return $content;
});
add_action('wp_ajax_get_full_phone', 'get_full_phone');
add_action('wp_ajax_nopriv_get_full_phone', 'get_full_phone');
function get_full_phone() {
if (!isset($_POST['post_id'])) wp_send_json_error('No post ID');
$post_id = intval($_POST['post_id']);
$footer_top = get_field('top_footer_box', 'option');
if (!isset($footer_top['col_2']['btn'])) wp_send_json_error('Phone not found');
$btn = $footer_top['col_2']['btn'];
$html = '<a class="btn_4" href="' . esc_url($btn['url']) . '" target="' . esc_attr($btn['target'] ?: '_self') . '">'
. esc_html($btn['title']) . '</a>';
wp_send_json_success(['html' => $html]);
}