daily pastebin goal
72%
SHARE
TWEET

Untitled

a guest Jan 24th, 2019 60 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. });
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top