Forums

[Plugin: WP-Table Reloaded] Make filters work with template tags (5 posts)

  1. heintore
    Member
    Posted 2 years ago #

    I love your article on how to extend the plugin with a filter, allowing you to choose which rows in the table to output.

    It works like a charm, but sometimes it's more convenient to use a template tag for such operations, as manually going through 50+ posts adding a second argument to each and one of them sounds like quite the hassle.

    Is this possible with the current implementation, or can it be modified somehow to allow for filters to be used with template tags?

    Thanks!

  2. TobiasBg
    Member
    Posted 2 years ago #

    Hi,

    thanks for the post! :-)

    You can usually use the added parameters with the template tag, as the logic behind them is the same.
    In this case, however, the " and & in the parameter value mess up the template tag parsing.

    Until I can work on that, here's a workaround:
    Instead of using a real template tag, you could use a fake Shortcode parsing. Just put the following code in your template, where you would normally put the template tag:

    <?php
    echo do_shortcode( '[table id=123 filter="a&&b" /]' );
    ?>

    The Shortcode would be a regular Shortcode with all possible parameters.

    Best wishes,
    Tobias

  3. kevcpu
    Member
    Posted 2 years ago #

    Is there a way to filter by the most recent record? Lets say I need newest or oldest row in the table, is this possible?

  4. HAMMADHASSAN
    Member
    Posted 2 years ago #

  5. TobiasBg
    Member
    Posted 2 years ago #

    Hi,

    @hammadhassan: That's the plugin we are talking about here already :-)

    @kevcpu: No, that is not possible. The plugin does not know when a record/row was added or modified.

    Best wishes,
    Tobias

Topic Closed

This topic has been closed to new replies.

About this Topic