Relevanssi
-
Hello!
Does the Relevanssi plugin allow a way for Ninja Tables content to be searched? I noticed the data in the tables aren’t currently showing up in our search results.
Larissa
The page I need help with: [log in to see the link]
-
Relevanssi should have automatic Ninja Tables support. It’s a bit of a hack, though, but Relevanssi looks for the
[ninja_tables id="xxx"]shortcode in post content and when it finds one, it reads the table contents directly from the Ninja Tables database table.If you look at the post with the Relevanssi debugger (Settings > Relevanssi > Debugging), does the Ninja Tables content appear in the post content there?
I have checked a few posts with Ninja Table content and it doesn’t seem to be showing in the debugging section of relevanssi.
I just tested this: I created a simple table with some text, added the table shortcode to a post and saved the post. Relevanssi indexed the table contents without problems.
A) What kind of content is there in your tables? Plain text or something else?
B) How are you adding the tables to the posts? Relevanssi only looks for the shortcode in the post content, so if it’s somewhere else, Relevanssi doesn’t see it.
A) Our tables include images and text.
B) Is it possible that Oxygen Builder is blocking relevannsi seeing the shortcode? We use that on our website.Yes, the problem is Oxygen builder. Oxygen stores nothing in post content, everything is in custom fields and thus the Ninja Tables compatibility is not working.
Try adding this code snippet on your site and saving a post with Ninja Table content:
add_filter( 'relevanssi_custom_field_value', 'rlv_oxygen_ninja', 9, 2 ); function rlv_oxygen_ninja( $content, $field ) { if ( 'ct_builder_shortcodes' === $field ) { $content = relevanssi_index_ninja_tables( $content ); } return $content; }I have tried adding that code to our site, however every time I do it throws an error.
See error: https://drive.google.com/file/d/10jYXIFvTUTAHMq92A-8y6jZ_j5cZQ84t/view?usp=sharing
You must have some kind of a copy-paste error there. The error is complaining about an extra & symbol, but there aren’t any in the code I gave you.
Sorry about that, I have amended the code and tried again. But it still doesn’t seem to be showing: https://drive.google.com/file/d/17cukM_0gz0Ywl3FTNe2YHRkNpGDi0YIB/view?usp=sharing
I have tried rebuilding the index as well.
This version should work:
add_filter( 'relevanssi_custom_field_value', 'rlv_oxygen_ninja', 9, 2 ); function rlv_oxygen_ninja( $values, $field ) { if ( 'ct_builder_shortcodes' === $field ) { $values = array_map( 'relevanssi_index_ninja_tables', $values ); } return $values; }This one’s tested with Oxygen and works well in my tests.
That creates a critical error 😀
Frontend screenshot: https://abbottstoragesystems493-my.sharepoint.com/:i:/g/personal/lflintoff_abbott-group_com_au/EaEGlielUyhPoLEdV3dc79IB7oUYDPQEJ5EBIyyvsRff6g?e=3jHEYH
Backend screenshot: https://abbottstoragesystems493-my.sharepoint.com/:i:/g/personal/lflintoff_abbott-group_com_au/EYI-_hSsWD1Ilcb4CIXWJiUBbFATnkwhgLaeaJG2xV7scA?e=4HI0aH
What’s the actual error message? Where have you placed the code? Can you please show me a screenshot of the code on your site?
I’m sure the code itself is correct and working: I copied it directly from a site where it works.
My fault I had duplicated the code.
The ninja tables data still doesn’t seem to be showing up: https://abbottstoragesystems493-my.sharepoint.com/:i:/g/personal/lflintoff_abbott-group_com_au/ER_PMG3aL8tCkkvKBD7BeMsBgHOtusE9gAzRV1XyBiapFQ?e=JFr28k.
And you’ve saved the post or rebuilt the index after adding the code?
Just tried that and it still doesn’t seem to.
In that case, I’m running out of ideas here. I’ve tested this code on my test site, and it’s working as expected. If you can show me how the
ct_builder_shortcodesfor that post looks like in thewp_postmetadatabase table, that may help, but other than that, I don’t really have much to say here.
The topic ‘Relevanssi’ is closed to new replies.