Forums

a little guidance with adding jquery into childtheme (9 posts)

  1. David
    Member
    Posted 10 months ago #

    Hi,
    Im trying to insert a nice little slideshow into my child theme page template, I know all the source paths are correct but it won't slide.

    Heres the slideshow im trying to add, http://css-tricks.com/examples/StartStopSlider/

    Im wondering if i need to use the wp_enqueue_script method but if thats the case than I'm a little unsure how to move forward.

    Any guidance would be greatly appreciated

  2. esmi
    Theme Diva & Forum Moderator
    Posted 10 months ago #

    You will need to enqueue those jQuery scripts, yes.

  3. fonglh
    Member
    Posted 10 months ago #

    I had to implement a jquery accordion and used wp_enqueue_script. You can check out my blog post about it. Hopefully it'll help you.

    http://wpadventures.wordpress.com/2011/06/23/custom-post-type-archives-jquery-accordion/

  4. David
    Member
    Posted 10 months ago #

    man this rabbit hole keeps getting deeper!

    @Esmi Thank you for clarifying

    @fonglh I appreciate you sharing that, I'm still a little unsure of how to make this work, can you clarify for me if wp_enqueue_script is a function for my functions.php amd how do I call it in my page template(can the function hook in and call it for me?)

  5. fonglh
    Member
    Posted 10 months ago #

    it goes into your functions.php. you just need the correct html markup in your page template (a div with the correct id).

    the scripts will be added to every page, but they'll only have an effect if there's something on the page for them to target.

  6. David
    Member
    Posted 10 months ago #

    so the enqueue function basically just replaces <script src>

  7. fonglh
    Member
    Posted 10 months ago #

    yes you can think of it that way. but it makes sure that dependencies are met and that scripts are not added multiple times.

  8. David
    Member
    Posted 10 months ago #

    thats incredible, it's working wonderfully. Thank you so much!! this unlocks so many possibilities, let me ask you one final question though, I didn't add any markup specifically to the html so I am wondering how it was able to pick up on it?

  9. fonglh
    Member
    Posted 10 months ago #

    the HTML has a <div> block with an id. jquery targets that id.

Reply

You must log in to post.

About this Topic