This is searchable archive of our old support forums, which operated from 2012 - 2016. To find out how to get support for your current theme, please visit our support page.

Reply To: Sortable table

#2583
iphoenix
Participant

There are these two as well:

http://wordpress.org/extend/plugins/sorttable-post/

http://wordpress.org/extend/plugins/easy-table/

but its just adding a lot of redundant coding if you don’t build it in to your child theme. Add sorttable post to your child theme:

1. Copy css into child theme’s css, change the colors to your theme:
/* SORTABLE TABLES */

table.sortable {
border-collapse: collapse;
clear: both;
width: 100%;
}

table.sortable thead tr {
background-color: #56411d;
color: #ffff09;
cursor: pointer;
font-weight: bold;
}

table.sortable tr:nth-child(even) { background: #fcf7e8; }

table.sortable th,
table.sortable td {
border: 1px solid #56411d;
padding: 4px;
vertical-align: top;
word-wrap: break-word;
}

table.sortable th:hover:not(.sorttable_nosort) {
background: #fa6900;
}

.sorttable_nosort {
cursor: default;
}
2. Add JS to child theme’s Assets folder
3. Enqueue JS:
function java_scripts() {
wp_register_script( 'themeblvd_theme-js', get_stylesheet_directory_uri() . '/assets/sorttable.js' );
wp_enqueue_script('themeblvd_theme-js');
}
add_action( 'wp_enqueue_scripts', 'java_scripts' );

4. Add sorttablepost.php to assets folder and add get templatepart to your functions:
get_template_part( 'assets/sorttablepost');
5. install theme and use shortcode if you want or use style=”sorttable” within your >table< tag

  • This reply was modified 7 years, 8 months ago by iphoenix.
  • This reply was modified 7 years, 8 months ago by iphoenix. Reason: mispell