WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] how to include Java and css in a post ? (8 posts)

  1. pri2sh
    Member
    Posted 4 years ago #

    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 .

  2. geezerd
    Member
    Posted 4 years ago #

    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

  3. pri2sh
    Member
    Posted 4 years ago #

    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

  4. geezerd
    Member
    Posted 4 years ago #

    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.

  5. geezerd
    Member
    Posted 4 years ago #

    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,
  6. pri2sh
    Member
    Posted 4 years ago #

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

  7. pri2sh
    Member
    Posted 4 years ago #

    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/

  8. sbruner
    Member
    Posted 3 years ago #

    You may want to try the Tabber Tabs Widget Plugin.

Topic Closed

This topic has been closed to new replies.

About this Topic