Skip to:
Content
Pages
Categories
Search
Top
Bottom

Child Theme : Adding jquery plugin to my child theme

  • Avatar of jamesjones
    jamesjones
    Participant

    @jamesjones

    I am trying to figure out how to add a jquery plugin i want to use on my site.

    At the moment i have it hard coded into the header.

    What is the best way to include it into my child theme.

    On an aside which may be related – i have been trying to include another php file into my child theme

    using <?php include( TEMPLATEPATH . ‘/somefile.php’ ); ?>

    This looks for it in the Parent theme file and not the child.

    What am i missing?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Avatar of Brajesh Singh
    Brajesh Singh
    Participant

    @sbrajesh

    well, for jquery plugin, use wp_enqueue_script in the child theme’s functions.php

    for your other problem, use this code

    <?php include_once(get_stylesheet_directory().'/somefile.php');?>

    This should solve the problem.

    The TEMPLATEPATH will point to parent theme not to the child theme.

    Avatar of jamesjones
    jamesjones
    Participant

    @jamesjones

    Thanks Brajesh.

    Figured out the wp-enque part shortly after i posted.

    Thanks for the include path

    Avatar of @mercime
    @mercime
    Keymaster

    @mercime

    to include another php file into my child theme e.g. somefile.php which is also in your child theme folder, simply done as …

    <?pho include ('somefile.php'); ?>

    Avatar of Andy Peatling
    Andy Peatling
    Keymaster

    @apeatling

    just use:

    <?php locate_template( array( 'somefile.php' ), true ) ?>

    Then you don’t have to worry about templatepath or stylesheetpath.

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

You must be logged in to reply to this topic.