Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    thanks for your question.

    This is possible with the [table-info /] Shortcode, that is described in the TablePress documentation at https://tablepress.org/documentation/

    In your case, you’ll want something like

    [table-info id=123 field="last_modified" format="human" /]

    For other date formats, you can also change the “format” parameter to “raw” or “mysql”.

    Regards,
    Tobias

    Thread Starter marketing guy

    (@el-terrible-bmw)

    Great thanks. How about if I use the template tag instead and do something like this:

    if( has_shortcode( get_the_content(), 'table' ) ) {
    	preg_match('/(?<=\[table id\=)(.*)(?=\/\])/', get_the_content(), $tableID );
    	echo '<p>Last Updated: ';
    	echo tablepress_print_table_info( array( 'id' => $tableID[0], 'field' => 'last_modified') );
    	echo '</p>';
    }

    Essentially, I’m trying to automate it so I don’t have to manually add the table-info shortcode to every page that has a table. Do you see anything wrong with that method?

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    no, that should absolutely work as well.
    You can however remove the echo before tablepress_print_table_info as that echoes already.

    Regards,
    Tobias

    Thread Starter marketing guy

    (@el-terrible-bmw)

    Cool thanks!

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    no problem, you are very welcome! ?? Good to hear that this helped!

    Best wishes,
    Tobias

    P.S.: In case you haven’t, please rate TablePress here in the plugin directory. Thanks!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Adding last modified date under the table’ is closed to new replies.