• Resolved fotoprijs

    (@fotoprijs)


    Hi Tobias,

    I created a small Table, like this:
    x | A | x | x
    x | B | x | x
    x | A | x | x
    x | C | x | x

    If I open the page with http://www.test.com?Type=A I only want to see the A rows

    1/ Plugin : URL Params
    I can use the short code [urlparam param=”Type” /], will give me A

    2/ Plugin : TablePress Extension: Row Filtering
    I can use the short code [table id=TEST filter=A], it will give me the result I want and only show me the A rows

    Is there a way, I can combine both shortcodes
    http://www.test.com?Type=A –> Gives me all the A rows
    http://www.test.com?Type=B –> Gives me all the B rows
    http://www.test.com?Type=C –> Gives me all the C rows

    What is the best approach or is there a better way, you suggest ?
    Should I make changes in the plugins or is there a way to combine the shortcodes like this [table id=TEST filter=[urlparam param=”Type”]]

    Hope this is clear

    Thank you very much

    https://wordpress.org/plugins/tablepress/

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Tobias Bäthge

    (@tobiasbg)

    Hi,

    thanks for your post, and sorry for the trouble.

    Combining the Shortcode parameters like this is not possible, but you are lucky, as there already is a TablePress Extension for exactly this 🙂 For details, please see https://tablepress.org/extensions/shortcode-filter-get-parameter/

    Regards,
    Tobias

    Thread Starter fotoprijs

    (@fotoprijs)

    Wow Tobias,

    This is exactly what I was looking for !
    (I must have overlooked it)

    Thanks a lot !

    Plugin Author Tobias Bäthge

    (@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!

    Thread Starter fotoprijs

    (@fotoprijs)

    Hi Tobias,

    I tried many different things, but it doesn’t seem to pick it up.
    http://www.fotoprijs.com/test/?table_filter=20×30

    I kept it as simple as possible with a test page and a test table [table id=TEST], but it doesn’t seem to filter on the parameter

    Kind Regards,

    PS. If I wanted to use a second filter as well, what would be the best way ?
    I’m thinking of making a copy of the plugin and alter it for a different filter e.g. Type_filter

    Plugin Author Tobias Bäthge

    (@tobiasbg)

    Hi,

    just to be sure, the TablePress Row Filter Extension is also installed and both Extensions are activated as plugins?

    To use a second filter, you would have to use the && operator that the Row Filter Extension offers, but it has to be white-listed first, by extending the line

    $filter_term = preg_replace( '#[^a-z0-9 ]#i', '', $filter_term );

    in the Extension.

    Regards,
    Tobias

    Thread Starter fotoprijs

    (@fotoprijs)

    Hi Tobias,

    My solution for future use :

    I forgot 1 thing : [table_filter id=TEST ], I overlooked this part.

    I added a line in you code (the && operator in URL is not possible),
    1/ Allow character_ in the filter term
    2/ Replace character_ with characters &&
    and it works perfectly.


    $filter_term = preg_replace( '#[^_a-z0-9 ]#i', '', $filter_term );
    $filter_term = str_replace('_', '&&', $filter_term);

    Kind Regards

    Just rated your plugin
    I’ll make a donation if I use it on my site 😉

    thank for the wonderful support so far

    Plugin Author Tobias Bäthge

    (@tobiasbg)

    Hi,

    no problem, you are very welcome! Great to hear that you could make it work! 🙂
    And thanks for wanting to donate, I really appreciate it!

    Best wishes,
    Tobias

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘Use URL parameter to filter Table rows’ is closed to new replies.