This may seem a bit of bizarre question, and I'm not sure if it's possible.
I have created a HTML table in wordpress, and have built a PHP loop to output post data in table format.
I am using this <a href="http://tablesorter.com/docs/" rel="nofollow">jQuery table sorted plugin</a> to make it a sortable table.
But my question is, is it possible using jQuery to add up all the numerical values in my table
column and output the result?
If a class needs to added to the
cell then that's cool, it will not affect the tablesorter.
Then I would like to output the result in my table footer cell.
Is this possible? I can't seem to find anything on google but I'm probably search for the wrong term.
Thanks
<strong>MY WORDPRESS LOOP GENERATING TABLE CONTENT</strong>
I have created a HTML table in wordpress, and have built a PHP loop to output post data in table format.
I am using this <a href="http://tablesorter.com/docs/" rel="nofollow">jQuery table sorted plugin</a> to make it a sortable table.
But my question is, is it possible using jQuery to add up all the numerical values in my table
Code:
<th>Hours</th>
If a class needs to added to the
Code:
<td><?php echo get_post_meta($post->ID, 'Labour Time Hours', true); ?></td>
Then I would like to output the result in my table footer cell.
Is this possible? I can't seem to find anything on google but I'm probably search for the wrong term.
Thanks
<strong>MY WORDPRESS LOOP GENERATING TABLE CONTENT</strong>
Code:
<?php
$data = new WP_Query(array(
'post_type' => 'job',
'order' => 'ASC',
'posts_per_page' => -1,
'orderby' => 'date'
)); ?>
<?php if ($data->have_posts()) : ?>
<table id="myTable" class="tablesorter">
<thead>
<tr>
<th>Date</th>
<th>Job Title</th>
<th>Category</th>
<th>Hours</th>
</tr>
</thead>
<tbody>
<?php while ($data->have_posts()) : $data->the_post(); ?>
<tr>
<td><?php the_time('Y/m/d'); ?></td>
<td><a href="<?php the_permalink() ?>" title="View Job" ><?php the_title(); ?></a></td>
<td><?php the_category(', ') ?></td>
<td><?php echo get_post_meta($post->ID, 'Labour Time Hours', true); ?></td>
</tr>
<?php endwhile; ?>
</tbody>
<tfoot>
<tr>
<td></td>
<td></td>
<td></td>
<td><!-- Total to go here --></td>
</tr>
</tfoot>
</table>
<?php unset($data); endif; wp_reset_query(); ?>