WordPress.org

Ready to get started?Download WordPress

Forums

jQuery Tablesorter pathway problem (3 posts)

  1. deserturchin
    Member
    Posted 5 years ago #

    I am trying to use the jQuery Tablesorter with my tables and I can't get it to work. I don't know if it is a pathway problem with the scripts location or if I have left something out. Does anyone have any experience or success with Tablesorter working in WordPress?

  2. cemuls
    Member
    Posted 5 years ago #

    Place this code to your header.php

    <script type="text/javascript" src="<?php bloginfo('stylesheet_directory'); ?>/YourFolder/jquery-latest.js"></script>
    	<script type="text/javascript" src="<?php bloginfo('stylesheet_directory'); ?>/YourFolder/jquery.tablesorter.js"></script> />

    "YourFolder" is a folder under your theme directory, copy and paste jQuery-latest.js and jQuery.tablesorter.js to "YourFolder"

    In your post or page. place following code

    <table id="YourTableName">
    <thead>
    <tr>
        <th>No</th>
        <th>Name</th>
        <th>Address</th>
        <th>Salary</th>
        <th>Web Site</th>
    </tr>
    </thead>
    <tbody>
    <tr>
        <td>1</td>
        <td>John</td>
        <td>California</td>
        <td>$5000</td>
        <td>http://www.jhon.com</td>
    </tr>
    <tr>
        <td>2</td>
        <td>Udin</td>
        <td>Majalaya</td>
        <td>$10000</td>
        <td>http://www.udin.com</td>
    </tr>
    
    </tbody>
    </table>

    Place this code into javascript jquery.tablesorter.js

    $(document).ready(function()
        {
            $("#YourTableName").tablesorter();
        }
    );

    YorTableName is your table ID that you can change. you can customize your table.

    may be that's what I know, I don't know how to customize it with my css theme, anyone who can add?

  3. deserturchin
    Member
    Posted 5 years ago #

    Thank you very much. I got it to work if I write out the table manually but I will be using php generated tables and it doesn't seem to work on the tables generated within the Loop. Do you know how to get around this?

    Thanks

Topic Closed

This topic has been closed to new replies.

About this Topic