Get ACF value in external jQuery document

Your question is not entirely clear, but it looks like you are in need of wp_localize_script, which allows you to pass variables from PHP to a script. You would use it like this (example with two fields): add_action (‘wp_enqueue_scripts’,’wpse244551_add_field’); function wpse244551_add_field () { $my_field = array (); $my_field[] = array (field1 => get_field (‘field1’)); $my_field[] … Read more

Is there a way to optimize function that is used for returning data in an ajax-call?

Since you are not using $field_value after if-else, you can start rewriting that if if (substr($field_value, 0,4) === ‘http’) { $field_value=”<a target=”_blank” href=”” . $field_value . ‘”>’ . $field_value . ‘</a>’; } /* else { no else statement here! } */ and just use it later like this: $html .= ‘<span class=”lajax-value”>’ . $field_value . … Read more

Filter WP user acf field by ajax

The problem is your action names don’t match In your frontend code: ?action=find_coach’; But in your backend code: add_action(‘wp_ajax_search_coach’, ‘searchLifeCoach’); add_action(‘wp_ajax_nopriv_search_coach’, ‘searchLifeCoach’); search_coach != find_coach, they have to match. Note that if this code used the REST API, it would have given a 404 and stated the problem in human readable language, e.g. { “code”:”rest_no_route”, … Read more

Vimeo thumbnails [closed]

Maybe this can help $videoID = the_field(‘video_link’); $jsonurl=”http://vimeo.com/api/v2/video/”.$videoID.’.json’; $json = file_get_contents($jsonurl,0,null,null); $json_output = json_decode($json,true); echo ‘<img src=”‘. $json_output[0][‘thumbnail_large’] .'” />’; It’s the same call using json method

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)