WordPress.org

Ready to get started?Download WordPress

Forums

Add image rotating script to a wordpress page? (5 posts)

  1. Zavarzin
    Member
    Posted 2 years ago #

    [ Moderator Note: Please post code or markup snippets between backticks or use the code button. Not the single quote, that doesn't work. ]

    Hello!

    There is a simple javascript called magicimage (http://www.echochrist.com/magicimage.php).

    I know how this code gets embedded into an html page because there is an example .html file and here is its content:

    <html>
    <HEAD>
    
    <meta http-equiv="Content-Language" content="en-us">
    
    <script
    		language="JavaScript"
    		src="magicimage.js"
    		type="text/javascript">
    </script>
    
    </HEAD>
    
    <BODY>
    
    <table width="150" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td><div id="MagicImage"></div></td>
      </tr>
    </table>
    
    </div>
    <p> </p>
    
    </body>
    </html>

    But can someone tell me how and where do I add this code to a wordpress page to make the script work?

    Thanks

  2. esmi
    Forum Moderator
    Posted 2 years ago #

  3. Or...

    This plugin

    It's a much less appealing option than what esmi mentioned above... but gives you a graphical interface for including scripts only on certain pages.

  4. Zavarzin
    Member
    Posted 2 years ago #

    I read this page http://codex.wordpress.org/Function_Reference/wp_enqueue_script but I didn't get a clue on how to exactly do this in my case.

    There is a file magicimage.js that I need to upload to the server then if it was a simple html page I would put this

    <script
    		language="JavaScript"
    		src="magicimage.js"
    		type="text/javascript">
    </script>

    between head tags and then

    <table width="150" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td><div id="MagicImage"></div></td>
      </tr>
    </table>

    [Moderator Note: Please post code or markup snippets between backticks or use the code button.]

    between body tags to indicate where exactly the script must appear in my post, but in a case of wordpress, if i want this random images to show just inside my post (not on the sidebar and not in the footer) what exact code do I need to use and where to put it? I tried lot of things but I cannot figure out the hack on my own.

    Can someone tell me the exact code please?

  5. lcp2000
    Member
    Posted 2 years ago #

    You can edit your header.php template and place the script within the head tags. The only problem I see here is if you upgrade wp you may have to edit php file over again.

Topic Closed

This topic has been closed to new replies.

About this Topic