• Resolved harvoolio

    (@harvoolio)


    Thanks for the plugin.

    Currently Arconix is the only plugin of mine that uses jQuery Migrate which I am loading in the header.

    Is there a conditional to check when Arconix is running that I can use to load it only on pages with Arconix shortcodes (I can also use it for other Arconix scripts)? Also, can jQuery migrate at least be loaded in the footer?

    Thanks.

    https://ww.wp.xz.cn/plugins/arconix-shortcodes/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author John Gardner

    (@jgardner03)

    The default plugin behavior will load the arconix js in the footer. I believe to get the migrate script in the footer you’d have to unregister Migrate and re-register it setting the footer param to true.

    I’m not sure I understand this sentence:

    Is there a conditional to check when Arconix is running that I can use to load it only on pages with Arconix shortcodes

    My plugin registers the script, and then on pages where the shortcode is used I actually tell WordPress to load the javascript. Are you talking about javascript or CSS?

    Thread Starter harvoolio

    (@harvoolio)

    No worries. Thanks. I load Arconix from a protected folder so I needed to add that dependency.

    // Load arconix-shortcodes-js from protected folder
    add_filter(‘pre_register_arconix_shortcodes_js’, ‘__return_false’);

    add_action(‘wp_enqueue_scripts’, ‘arconix_scripts’);

    function arconix_scripts() {
    wp_register_script(‘arconix-shortcodes-js’, ‘http://www.example.com/wp-content/themes/dynamik-gen/arconix-shortcodes’.
    ‘/arconix-shortcodes.js’, array(‘jquery-migrate’, ‘jquery-tools’), ‘1.0’, true);
    }

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Conditionally Load jQuery Migrate’ is closed to new replies.