WordPress.org

Ready to get started?Download WordPress

Forums

code for adding Jquery plugin (2 posts)

  1. groenhans
    Member
    Posted 1 year ago #

    Hi all,

    I've been trying to get a query plugin to work on my WordPress site. It's not though and I'm hoping someone could tell me what I'm doing wrong...
    I went about as following:

    First I put the files

    curtain.js
    curtain.css
    scripts.js

    in a js folder, which I put in my theme folder. I am using a child theme!

    I then put the following code in the functions.php of my child theme.

    function my_scripts_method() {
    if (!is_admin()) {
    wp_register_script( 'curtain', get_stylesheet_directory_uri() . '/js/curtain.js', array( 'jquery' ) );
    wp_register_script( 'scripts', get_stylesheet_directory_uri() . '/js/scripts.js', array( 'jquery' ) );
    wp_enqueue_script('curtain');
    wp_enqueue_script('scripts');
    wp_enqueue_script('jquery');
    }

    add_action('wp_enqueue_scripts', 'my_scripts_method');

    ..then this code in the scripts.js:

    $(document).ready(function(){
    $('.curtains').curtain();

    });

    I now just see the actual code on my front page and I get the following message (amongst others):

    Warning: Cannot modify header information - headers already sent by (output started at /data/home/stat01/domains/statesofgrace.nl/public_html/wp-content/themes/weaver-ii-child-demo/functions.php:4) in /data/home/stat01/domains/statesofgrace.nl/public_html/wp-login.php on line 368

    What's going wrong here??

    Thanks in advanceā€¦

    Hans

  2. mantismamita
    Member
    Posted 12 months ago #

    Its probably because WordPress does not accept the dollar sign. The plugin needs to be adapted.

Topic Closed

This topic has been closed to new replies.

About this Topic