- November 2, 2020 at 2:32 pm #30095
A) I am using:
- Theme > ET EXTRA (like Divi)
- AJS Pro Setting > General Options > Sources > ‘Index Table Engine’
(to make it faster as in the future we will have thousands of posts/lessons).
Trouble is, that AJS is also indexing the sidebars of our courses and therefore displays keywords from course chapters that are irrelevant.
I read about the DIVI/Search challenge (https://wp-dreams.com/forums/topic/remove-sidebar-menu-items-from-search-results/)
But I can’t go back to AJS’ ‘Regular Engine’ for obvious speed/DB workload reasons.
B) My question
- Does AJS offer a ‘CSS Span/div tag/class’ that can be implemented in order to prevent the engine from indexing the content within that area?
- Or is there a way to exclude certain DIVs? (Haven’t found any function for that).
- If you search for “actor/actors”, you get a bunch of results, but actually, only 3 posts (lessons) are about “actors) stuff.
- All the other results are showing because in the course navigation widget, they are in the sidebar where the word “Actors” is one of the section title.
Thanks for a hint if this is possible to solve.
DanNovember 2, 2020 at 2:58 pm #30101
The plugin only indexes the parts of the post content, so the sidebars are probably also part of the page builder and stored within the post content. If it is stored in the raw content as a shortcode, then you could add the sidebar shortcode to the exceptions list, and that may resolve it: https://i.imgur.com/hQFV6ft.png
If it does not have a separate shortcode, then it is probably still possible, but can be difficult, and will require a programmatical solution. The post content, before the index table tokenization goes through 2 filter hooks, which let you access and change the content:
$content = apply_filters( 'asp_post_content_before_tokenize_clear', $the_post->post_content, $the_post );
$filtered_content = apply_filters( 'asp_post_content_before_tokenize', $content, $the_post );
I would start by hooking into the first one, to see what the content looks like, and then try to figure out a way, possibly via PHP DomDocument to find the sidebar nodes, and remove them.Best,
If you like my products, don't forget to rate them on codecanyon :)
November 5, 2020 at 9:52 am #30148
Thank you for your swift reply and the different approaches.
As the shortcode workaround is not feasible here, I will have a look into the filters. I am sure we will find a solution at our end.
Thanks for revealing the 2 filter hooks.
You must be logged in to reply to this topic.