Forum Replies Created

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter RazziaDK

    (@razziadk)

    Anyone? 🙂

    Thread Starter RazziaDK

    (@razziadk)

    I’m sorry for yet another questtion, but I am not very familiar with javascript.. 🙂

    I’ve tried adding the wrapper in the .js file.

    Do I still “fire” the plugin with this command in the WP page? :

    <script type="text/javascript" src="/wp-content/themes/twentyeleven/caroufredsel/caroufredsel.js"></script>
    <script type="text/javascript">
    <!--
    carouFredSel();
    //--></script>

    Thread Starter RazziaDK

    (@razziadk)

    No, but I have now.

    I expect that I might use jquery and caroufredsel on several pages and therefore I’ve tried adding them using wp enqueue script. I’ve added the following code in my functions.php in the current theme.

    function my_scripts_method() {
        wp_deregister_script( 'jquery' );
        wp_register_script( 'jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js');
        wp_enqueue_script( 'jquery' );
    }    
    
    add_action('wp_enqueue_scripts', 'my_scripts_method');
    
    function carouFredSel-6.1.0() {
        wp_deregister_script( 'caroufredsel' );
        wp_register_script( 'caroufredsel', get_template_directory_uri() . '/caroufredsel/jquery.carouFredSel-6.1.0.js');
        wp_enqueue_script( 'caroufredsel' );
    }    
    
    add_action('wp_enqueue_scripts', 'carouFredSel-6.1.0');

    The javascript code for the specific page I added to a seperate .js file and try loading that from the page code like this:

    <script type="text/javascript" src="/wp-content/themes/twentyeleven/caroufredsel/caroufredsel.js"></script>
    <script type="text/javascript">
    <!--
    caroufredsel();
    //--></script>

    As you can see from this page it still doesn’t work.

    Have I misunderstood the use of javascript in WordPress, or have I just implemented it the wrong way?

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