Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript [Solved] How to call javascript file in WordPress ?

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #150147
    apart
    Participant

    I know how to call style.css but how do i call 2 files I need for Collapsible panel with JavaScript.

    <script src="SpryAssets/SpryCollapsiblePanel.js" type="text/javascript"></script>
    <link href="SpryAssets/SpryCollapsiblePanel.css" rel="stylesheet" type="text/css" />
    

    This is how it’s normaly called but now that I’m on wordpress it doesnt work.

    #150148
    apart
    Participant

    Found it.

    <script src="<?php bloginfo('template_url'); ?>/SpryAssets/SpryCollapsiblePanel.js" type="text/javascript"></script>
    <link href="<?php bloginfo('template_url'); ?>/SpryAssets/SpryCollapsiblePanel.css" rel="stylesheet" type="text/css" />
    
    #150166
    Senff
    Participant

    You might want to look into the wp_enqueue_script method though: http://codex.wordpress.org/Function_Reference/wp_enqueue_script

Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.