Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Tablepress table not showing preview
This topic contains 5 replies, has 2 voices, and was last updated by Ernest Marcinko 2 years, 2 months ago.
- AuthorPosts
- January 12, 2021 at 4:44 pm #31097
Hi there,
I am using Tablepress for tables, and i activated the Index engine to include that in Ajax Pro search results.
However, when I search, the page “Test Table” shows up but no description preview of the content shows.
You can try searching with the keyword “Claison”. The preview results correctly show for a different page with the same data(Phone-EMMC), but not done through the Tablepress plugin.
If you go to the tablepress page, the text is white on a whiteish background so it’s hard to see. I need to fix the CSS but all the data is there.
January 13, 2021 at 2:15 pm #31112Hi,
If I understand correctly, you want to display some of the tablepress table data within the live search preview?
Best,
Well, the plugin by default gets only the unexecuted shortcode contents, but you can try changing that here. That does not mean, it will work properly or at all though – as many shortcodes, including the tablepress plugin are designed to work on a single page context.
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
January 13, 2021 at 2:26 pm #31116Hi Ernest!
Thank you for your quick support. Yes, exactly, I want to display some of the tablepress table data around the search hit term in the live search preview. The idea here is that the table is for phone numbers, and if the information needed shows up on the live preview, users will not even have to click through to the actual table page.
I tried the option you ask, and did an index rebuild, and all it did was give the shortcode as the preview. See attached screenshot:
Attachments:
You must be logged in to view attached files.January 13, 2021 at 4:10 pm #31122That means the shortcode is probably not registered at that time of execution. Maybe a solution with a custom code may work, but I cannot guarantee that either.
Try adding this custom code to the functions.php in your theme/child theme directory. Before editing, please make sure to have a full site back-up just in case!
Best,add_filter( 'asp_results', 'asp_force_execute_shortcodes', 10, 1 ); function asp_force_execute_shortcodes( $results ) { foreach ($results as $k=>&$r) { if ( isset($r->post_type) ) { $r->content = apply_filters('the_content', get_post_field('post_content', $r->id)); } } return $results; }
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
January 14, 2021 at 12:39 am #31125Hi Ernest,
Thanks for this code. However, it expanded the search for the page without tables, but for the page with Tablepress table it didn’t do anything:
See screenshot attached.
Attachments:
You must be logged in to view attached files.January 14, 2021 at 11:08 am #31128In that case I’m afraid this is probably not possible. The tablepress shortcode is very likely not registered in that context of execution. Maybe one last chance via forceful shortcode execution with this code:
add_filter( 'asp_results', 'asp_force_execute_shortcodes', 10, 1 ); function asp_force_execute_shortcodes( $results ) { foreach ($results as $k=>&$r) { if ( isset($r->post_type) ) { $r->content = do_shortcode(apply_filters('the_content', get_post_field('post_content', $r->id))); } } return $results; }
But very likely this variation will not change anythig, if the shortcode does not exist yet.
Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
- AuthorPosts
You must be logged in to reply to this topic.