Support

Account

Forum Replies Created

  • Hi Elliot

    Still no luck on getting the right scripts to load at the right moment 🙁
    I must be overlooking something but I just don’t see what.

    I’ve solved the problem for now by loading them manually.

    Thanks for your time!
    annelyze

  • Hello Elliot

    Thx for the quick reply. This however didn’t fix the problem.

    If I take a look at the acf_form_wp_head function I see the following:

    function acf_form_wp_head()
    {
    	do_action('acf/input/admin_head');
    }

    So in fact I already did the do_action part, only from within a function (which I called in my custom code).

    I’ve tried some other placements for the do_action in my code but this didn’t work either. I’m not a frequent WordPress user so I’m not sure what to try next.

    This is the current situation:
    I’ve added a hook to a custom function:
    add_action('admin_head', 'cjobs_admin_head');

    In that function I’ve put the do_action:

    function cjobs_admin_head()
    {
    	do_action('acf/input/admin_head');
    }

    This is already something different than the code I used in version 3.x. In that version all I had to do was call the acf_form_wp_head function just before parsing the acf fields.

    This is the acf_form_wp_head function in version 3.x:

    function acf_form_wp_head()
    {
    	// global vars
    	global $post, $acf;
    
    	// Style
    	echo '<link rel="stylesheet" type="text/css" href="'.$acf->dir.'/css/global.css?ver=' . $acf->version . '" />';
    	echo '<link rel="stylesheet" type="text/css" href="'.$acf->dir.'/css/input.css?ver=' . $acf->version . '" />';
    
    	// Javascript
    	echo '<script type="text/javascript" src="'.$acf->dir.'/js/input-actions.js?ver=' . $acf->version . '" ></script>';
    
    	// add user js + css
    	do_action('acf_head-input');
    }
Viewing 2 posts - 1 through 2 (of 2 total)