Support » Plugin: TablePress » Pull Title into row filtering search query

  • Resolved ashleyjbassett

    (@ashleyjbassett)


    Hello,

    I’ve manually created a table across hundreds of pages….and when something changes, we need to manually change each of the pages….

    I want to go a global search and replace string across all the pages, and insert the table press shortcode.

    What I need is, if it’s possible, is to use the page title as the row filtering search. So instead of manually typing the search criteria, I want to use the page title to search in the master table column.

    Do you think this is possible?

    Thanks

    Ashley

    The page I need help with: [log in to see the link]

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

    (@tobiasbg)

    Hi,

    thanks for your post, and sorry for the trouble.

    Yes, this should be possible. The best way would be to define a custom shortcode, e.g. by adding this code to your theme’s functions.php::

    add_shortcode( 'table-filter-title', 'tablepress_filter_table_by_title' );
    function tablepress_filter_table_by_title( $atts ) {
      $atts['filter'] = get_the_title();
      return tablepress_get_table( $atts );
    }

    Then, on your pages, you would just need to use the Shortcode

    [table-filter-title id=123 /]
    

    Regards,
    Tobias

    Thread Starter ashleyjbassett

    (@ashleyjbassett)

    Oh my goodness, that was quick!

    As usual – amazing support. A little ahead of myself but will be able to try this tonight.

    Appreciate it Tobias!

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    no problem, you are very welcome! I hope this helps!

    Regards,
    Tobias

    Thread Starter ashleyjbassett

    (@ashleyjbassett)

    Tobias – worked perfectly. Thanks.

    Now I use this table and display on many pages a specific row based on title (which you helped with above). In most cases this is a single row, so I have turned off search, sort etc functions on this table.

    On one page, I show the master – full table. What is the shortcode to enable these functions (filter, search etc), or do I have to duplicate the table?

    The table content relates to categories. Is it possible to assign a background colour to a category (of a column contains the category?)

    Thanks Again

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    to enable the JS features, add the Shortcode parameter:

    use_datatables=true
    

    I’m not really sure what you mean with that category question. Can you please post a link to the page with the table where this problem happens, so that I can take a direct look? Thanks!

    Regards,
    Tobias

    Thread Starter ashleyjbassett

    (@ashleyjbassett)

    Great! Thanks

    It’s not live at the moment and haven’t got a full version of the table. Imagine a table where rows belong to a category. Rows 1-10 cat 1, Row 11-30 cat 2, Rows 31-40 cat3. I’d like the background colours for all rows that are cat 1 to be blue, all rows of cat 2 yellow and rows that are cat pink (for example).

    Thanks

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    ah, I see. For that, you could take a look at the approach from https://wordpress.org/support/topic/highlight-a-row-based-on-value/

    Regards,
    Tobias

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Pull Title into row filtering search query’ is closed to new replies.