Help with javascript and wordpress (5 posts)

  1. Anonymous
    Posted 7 years ago #

    I have made a css layout with a css menu using the code from here : http://devthought.com/cssjavascript-true-power-fancy-menu/

    However when I started to convert the layout into a wordpress theme the javascript part of the menu does not work.

    Please may someone show me the code that will make the menu function fully in a wordpress theme?

    Thanks in advance for any help!


  2. Joshua Lyman
    Posted 7 years ago #

    Link to the site?

    Your javascript calls will probably need to go in header.php of your theme.

  3. Anonymous
    Posted 7 years ago #

    Im running it on localhost but here is the code im using:
    This is in the head tag:

    `<script language="javascript" src="scripts/mootools.js" type="text/javascript"></script>
    <script language="javascript" src="scripts/menu.js" type="text/javascript"></script>'

    And this is the menu I would like the javascript to work with:

    '<div id="fancymenu">


    This worked when I made the css template - as soon as I converted it to a wordpress theme the javascript stopped working.

    Thanks for your help.

  4. Joshua Lyman
    Posted 7 years ago #

    Where are your javascript files placed? Are they in the same directory as your theme, or are they stored somewhere near the root of your site?

    If they are in the same directory of your theme, then add <?php bloginfo('template_directory'); ?> to the beginning of your src= path. Remember that even tho your header.php is physically located in your themes/ folder, when it is called and processed, it will be done at the root of your site, so you have to think where your files are relative to this.

    (BTW, the backtick is located usually left of the 1 on the keyboard. Took me forever to find that character... ;-))

  5. Anonymous
    Posted 7 years ago #

    Thanks for the response, your advice worked. :-)

    I'm really greatful!

Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.