How to use SortTable Post

SortTable Post
[ sorttablepost ]

HIDE STANDARD COLUMNS
[ sorttablepost nothumb=”true” nodate=”true” nocats=”true” notags=”true” ]
You can omit any undesired columns by using one or more of these shortcode options.

SHOW CUSTOM POST TYPE
[ sorttablepost type=”my-custom-post-type” ]
You can specify the name of a custom post type (or `page`), instead of showing posts.

USE CUSTOM TAXONOMIES
[ sorttablepost cat=”my-custom-taxonomy” tag=”another-custom-taxonomy” ]
You can replace the standard `Categories` or `Tags` columns (or both) with custom taxonomies.

USE CUSTOM FIELDS
[ sorttablepost meta=”Custom Field Key,Another Custom Field Key,Yet Another” ]
As of version 4.0, you can add as many custom field columns as you like. Use a comma-seperated list of field keys.

ASSIGN UNIQUE ID TO TABLE
[ sorttablepost id=”mytable” ]
As of v4.2, you can give each table a unique ID. This is particularly useful when displaying multiple tables on the same page, as it allows you to style each one differently.

STYLE THE TABLE USING CSS

I know, I know. The default colors look pretty nasty in most themes. Below is the code I used to change the default colors to match my theme on this site. You can add similar code to your theme’s `style.css`.

/* Header Row Colors */
table.sortable thead tr {
background-color: #71a7c8 !important;
color: #fff !important;
}

/* Highlight Color for Header Row Cells on Hover*/
table.sortable th:hover:not(.sorttable_nosort) {
background: #b3d0e1 !important;
}

/* Shading For Even Rows */
table.sortable tr:nth-child(even) { background: #f6f6f6 !important; }

/* Table Border Color */
table.sortable th,
table.sortable td {
border: 1px solid #71a7c8 !important;
}

/* Style & Width of Particular Columns */
table.sortable td.col3,
table.sortable td.col4,
table.sortable td.col5,
table.sortable td.col6,
table.sortable td.col7 {
text-align: center !important;
width: 10% !important;
}

Posted in Wordpress