• Im the developer for Easy Modal plugin and im trying to work out a bug with your plugin and mine. It seems that you are most likely using the new has_shortcode function to determine weather the scripts and styles are loading properly.

    The modals are preloaded before the closing body tag and therefore outside the loop and not going to show up in has_shortcode therefore if there is no other form on the page the modal form lacks styling & scripting for ajax etc.

    Im wondering if you could maybe if it doesnt already exist add a filter that users could add to their functions.php file or i could use some type of detection in my plugin to enable those scripts via the hook/filter?

    Thanks for your time.

    http://wordpress.org/plugins/ninja-forms/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author James Laws

    (@jameslaws)

    The problem is that Ninja Forms loads various resources based on what the particular form needs which can be different from form to form based on form options, fields settings, and other extensions. There would be no way to trust that another plugin developer and especially a user would know what to include for any particular form since Ninja Forms doesn’t even know until the form display is being generated.

    That being said, I’ve installed you plugin to see if I can reproduce what you are seeing and see if I can see why it’s happening but after I activate your plugin and visit any if your plugin admin pages I get this error message: Warning: require_once(C:\wamp2\www\WordPress/wp-content/plugins/easy-modal/inc/dashboard.php): failed to open stream: No such file or directory in C:\wamp2\www\wp-content\plugins\easy-modal\easy-modal.php on line 325

    Thread Starter Daniel Iser

    (@danieliser)

    Thanks for the quick reply. Sorry the version up currently 1.1.9.9 is a placeholder for the latest version 1.2. Currently 1.2 is just out of beta and being cleaned up and documented now. Email me at danieliser @ wizardinternetsolutions.com and i will get you a copy to work with. This would be preferable over 1.1.9.9 as there are fundamental changes in how it functions ie before modals and content were loaded purely by ajax requests. But this led to many issues with plugins not working properly since their scripts ran when the page loaded not after the modal was opened. With v1.2 modals are now preloaded in the footer and on page when the scripts initially run.

    How exactly are you detecting the components to load? Maybe i could just hook the modal contents loading into the same flow.. IE if you are using a hook etc i could add my contents to that particular hook so you can then detect them.

    Thread Starter Daniel Iser

    (@danieliser)

    Verion 1.2.0.9 is available and fixes nearly all bugs found. But I was just wondering how you actually que up the scripts and styles. Would it be possible to add a filter in this location that allows the programmatic queuing of a forms resources?

    Something like
    ‘add_filter(“ninja_forms_enqueue_forms”, “load_these_forms_always”)
    function load_these_forms_always($current_forms){
    $current_forms[] = 1; //where 1 is the form if etc
    return $current_forms;
    };’

    So then in your enqueue scripts section something like
    ‘$form_list = array(); // set using your current method of detection.
    $load_forms = apply_fillters(“ninja_forms_enqueue_forms”, $form_list);
    //enqueue scripts based on $load_forms

    Sorry for any mistakes. I typed this on my iphone.

    Plugin Author Kevin Stover

    (@kstover)

    If you use the ninja_forms_display_js action hook, it is passed the $form_id as its only variable. That tells you which form is being displayed so that you can conditionally enqueue scripts.

    Thread Starter Daniel Iser

    (@danieliser)

    So how would this look if say added via another plugin or theme? Usage example loading it via my modal plugin. It isn’t detected when your scripts are enqueued so the form is dead. If users wanted say forms 1,3,4 to always load resources because their in a modal hidden on every page how could I use the action you mentioned to que these. It seems more like a job for a filter as I don’t want to output anything myself, just filter the list your plugin will enqueue already.

    Thanks in advance for any help

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Using shortcodes outside of the loop. Styles & Scripts not loaded’ is closed to new replies.