I'm making a plugin: how to include mootools only when necessary? (1 post)

  1. Michael Fields
    Posted 6 years ago #

    I'm making a new plugin that incorporates Smooth Gallery. If you are familiar with Smooth Gallery, it is a javascript apparatus built upon the prototype framework. I am just getting around to building the custom actions that will be used in theme/template pages when I ran into a question: "How do I only include the mootools library on pages that use the action".

    I've been able to accomplish this in the wp-admin section rather easily by checking the value of $_GET['page'], but I am lost as to how to go about this in the live blog. What I'd like to do is represented in pseudo code below"

    function my_wp_head(){
      if( $theme_file_uses_my_custom_action )
        wp_enqueue_scripts( 'mootools' );
    add_action( 'wp_head', 'my_wp_head' );

    Any thoughts here? I can't wrap my head around this one. Thanks in advance,

Topic Closed

This topic has been closed to new replies.

About this Topic