Hi,
thanks for your post, and sorry for the trouble.
TablePress does integrate into the WordPress search already, actually, i.e. all tables that are embedded (with their Shortcode) into a post or page, will be searched.
Regardless, you could maybe use the information in the tablepress_tables option (that you can load with get_option()). That contains an array with the table ID in the key and the post ID in the value.
Regards,
Tobias
Hi Tobias,
Thanks for the quick response. I should have been more specific, I am using openSearchServer to index my site and the coordinating WP plugin to modify standard search. The URL snippet I posted before was the URL field from the oss-results, my plan is to print table as described in place of the oss generated content:
[[“Click in this area to sort these files”],[“Accidental Hazardous Exposure”],[“Adverse Reaction Investigation Report”],[“Authorization Form “],[“Authorization Form (Spanish)”],[“Activity- IEB Eye Tissue Recovery”],[” Activity – Procurement “],[” Activity- Transport”],[“Attention Pickup…
Hi,
ah, ok, I see.
Yes, then extracting the table ID from the post ID might be the best option.
Regards,
Tobias
Thanks, just to clarify: do I call get_option() on the post_id?
Hi,
no, you use
(array) json_decode( get_option( 'tablepress_tables' ), true );
to get an array that contains the table ID to post ID relationship.
Regards,
Tobias
You are amazing! I got the search to display tables directly in the results. The only problem I have now is that I’m passing id=$table_id&use_datatables=true&print_name=false to tablepress_print_table but it still prints the table name… Any idea why that would happen?
Also, and I’m sorry if this is annoying you, it would great if there were a way to pass a parameter through tablepress_print_table that would pass to the table’s search field. That way I could narrow down the table’s contents to the term searched.
Hi,
good to hear that this is working!
Instead of using the string parameter, I suggest to use the array version, which is more flexible and easier to read:
tablepress_print_table( array(
'id' = > $table_id,
'print_name' => false,
'use_datatables' => true,
) );
I’m not sure about the table name though. Are you sure that that’s coming from the plugin and not maybe because it’s written above the Shortcode as text? Also, you should not really need those Shortcode parameters, if the corresponding checkboxes are set on the tables’s “Edit” screens.
Regarding that filter parameter: You could use this TablePress Extension to only show the matching rows: http://tablepress.org/extensions/row-filter/
Or, you could use this one http://tablepress.org/extensions/datatables-auto-filter/ to use the JS-based search.
Regards,
Tobias
Regards,
Tobias
I’m all set now, thank you again for help.
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!