Guest User

Untitled

a guest
Jan 24th, 2019
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. jQuery.noConflict();
  2. jQuery(document).ready(function($) {
  3. var foo1 = acf.get('the_description');
  4. console.log(foo1);
  5. });
  6.  
  7. add_action( 'wp_enqueue_scripts', 'my_scripts_method' );
  8. function my_scripts_method(){
  9. wp_register_script( 'acf-input', acf_get_dir( "assets/js/acf-input.min.js" ), array('jquery'), acf_get_setting('version'), true );
  10. wp_enqueue_script( 'custom', get_template_directory_uri() . '/js/custom.js', array('jquery','acf-input'),null,true);
  11. });
  12.  
  13. acf.add_action('ready', function( $el ){
  14. var foo2 = acf.get('the_description_natural');
  15. console.log(foo2);
  16. });
  17.  
  18. acf.getField('the_description'); // не acf.get()
  19.  
  20. wp_enqueue_script( 'custom', get_template_directory_uri() . '/js/custom.js', array('jquery','acf-input'),null,true);
  21. wp_localize_script('custom', 'custom_vars', array(
  22. 'natural' => get_field("the_description_natural",$post_id)
  23. )
  24. );
  25.  
  26. jQuery.noConflict();
  27. jQuery(document).ready(function($) {
  28. console.log(custom_vars.natural));
  29. });
Add Comment
Please, Sign In to add comment