Hi,
ok, in that case, the following process should be the best.
At first, you’ll need to make a modification to WP-Table Reloaded. I will also add this to all future versions (as it is actually something that should already have been there, I just must have forgotten it), so that you won’t have to do this again in the future, but only for WP-Table Reloaded 1.9.2.
That is: Open the file “controller-frontend.php” in the “controllers” subfolder and in line 148, before the
return $output;
add the line
$output = apply_filters( 'wp_table_reloaded_shortcode_table_info_output', $output, $atts );
That will add the filter that you need, which however was not yet in place…
After that, you can use the filter to modify the behavior of the Shortcode [table-info ... field="last-modified" /]
.
At first, you will need to add the additional parameter format="raw"
, to make it easier to determine the date format later on. So, as the new Shortcode, use
[table-info id=123 field="last-modified" format="raw" /]
Now, to actually filter the date, paste the following code into the “functions.php” of your theme.
add_filter( 'wp_table_reloaded_shortcode_table_info_output', 'wp_table_reloaded_change_last_modified_date', 10, 2 );
function wp_table_reloaded_change_last_modified_date( $content, $atts ) {
// only modify calls to the last modified date
if ( 'last-modified' != $atts['field'] )
return $content;
// $content now contains the raw datetime string
// manipulate as desired here, e.g. with PHP functions strtotime(), date(), etc.:
// $content = ...;
return $content;
}
At the position of the comment, you can use PHP to modify the date (in the $content
variable) to whatever you want, using the appropriate PHP functions. The best way probably is to transform the string back to a timestamp and then apply a new date output format to that.
Best wishes,
Tobias