WordPress.org

Support

Support » How-To and Troubleshooting » [Resolved] how to include Java and css in a post ?

[Resolved] how to include Java and css in a post ?

  • Hi, i am trying to include tabber Java script (http://www.barelyfitz.com/projects/tabber/) in one of my page only.
    I have tried
    <script type=”text/javascript” src=”locationof.js”></script>
    <link rel=”stylesheet” href=”locationof.css” TYPE=”text/css” MEDIA=”screen”>
    in post but it is not working .

Viewing 7 replies - 1 through 7 (of 7 total)
  • If it’s a PAGE, not a post, make a custom template

    http://codex.wordpress.org/Pages About half way down the page, look for “Creating Your Own Page Templates”.

    This post has some intructions, too

    i did as told but did not works ( i think i did wrong )

    the javascript to add is tabber.js
    and css in tabber.css
    and the codes are in 1.html file

    html?
    You’re working with php here, captain.

    Anyway, after looking at the tabber code, I think you can just add it in the header.php file of your theme.

    Find </title> in your header.php
    add this line BELOW it:
    <script type="text/javascript" src="replace this with the path to your tabber.js file"></script>

    then find </head>
    add this ABOVE it:
    <script type="text/javascript">document.write('<style type="text/css">.tabber{display:none;}<\/style>');

    Then just make a page as normal through the dashboard

    <div class="tabber">
    
         <div class="tabbertab">
    	  <h2>Tab 1</h2>
    	  <p>Tab 1 content.</p>
    
         </div>
    
         <div class="tabbertab">
    	  <h2>Tab 2</h2>
    	  <p>Tab 2 content.</p>
         </div>
    
         <div class="tabbertab">
    
    	  <h2>Tab 3</h2>
    	  <p>Tab 3 content.</p>
         </div>
    
    </div>

    If you were to make a page template, you would need to replace “<?php get_header(); ?>” with all the text in your header.php file and paste it into that new template (erasing <?php get_header(); ?>), then add in the tabber.js code line and the document.write code line in the header code you just pasted in (like I explained at the beginning). Which is probably why it didn’t work.

    I meant to say:
    “Then just make a page as normal through the dashboard and add in the html code to make it work:”

    <div class="tabber">
    etc, etc,

    thanks for help, problem is solved.
    and it is working now.

    i found another easy way to add custom css and js in wordpress post,
    take a look here,
    http://techmasher.co.cc/custom-javascript-and-css-in-specific-wordpress-page-post/

    You may want to try the Tabber Tabs Widget Plugin.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘[Resolved] how to include Java and css in a post ?’ is closed to new replies.
Skip to toolbar