• Hi people,

    I need to add a javascript to the head of a file that i use in the plugin..

    Please note that the file is a part of my form.. so i don’t have added it as a sub menu to my plugin menu.. So i start at a page with the main form then submit and it will display another form and so on..

    Now i need to add javascript to the third form..

    i think i have todo it with:

    function register_extra_settings_head() {
    	require_once('forms/extra-settings-head.php');
    }
    
    add_action('admin_head-PLUGIN_NAME_DIRECTORY/forms/extra-settings.php', 'register_extra_settings_head');

    i tried the above but it didn’t work.. i guess the paths aren’t correct?

    The file with the above code is in the root.. then i got a folder forms where the extra-settings and extra-settings-head is..

    BTW! When i submit a form i check if it is correct in ANOTHER file and then i do require(next_form.php) and so on.. so is it even possible to add it, or do i need to add it all to the head of the file where i require the forms? Because that file is added as the main page of the plugin..

    Any idea what i’m doing wrong?

    Thanks!

    [No bumping, please.]

Viewing 1 replies (of 1 total)
  • Thread Starter Jonas_

    (@jonas_)

    still need help on this…

    i tried looking at the admin_head hook, but without luck..
    I also dont’ know what i have to post after admin_head-??? because i require the form file (SO THERE IS ONLY BODY CONTENT IN THAT FILE!) into main.php..

    Is this even possible? Because i see a lot of code adding the wp_head to EXISITING pages on my plugin.. but as my form is split up into multiple pages.. WHICH YOU CAN’T ACCESS DIRECTLYE FROM THE PLUGIN MENU, I REQUIRE THEM INTO main.php so how do i do this? Please help!

Viewing 1 replies (of 1 total)
  • The topic ‘Add scripts to head section of a plugin file’ is closed to new replies.