Excluding specific DIVs? AJS-own "blocking" tags?

Home Forums Product Support Forums Ajax Search Pro for WordPress Support Excluding specific DIVs? AJS-own "blocking" tags?

This topic contains 2 replies, has 2 voices, and was last updated by DanHostettler45 DanHostettler45 1 year, 9 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #30095
    DanHostettler45
    DanHostettler45
    Participant

    Hi there,

    A) I am using:

    1. Theme > ET EXTRA (like Divi)
    2. 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

    1. 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?
    2. Or is there a way to exclude certain DIVs? (Haven’t found any function for that).

    C) Example:

    1. If you search for “actor/actors”, you get a bunch of results, but actually, only 3 posts (lessons) are about “actors) stuff.
    2. 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.
    3. https://www.staging2.iso1200education.com/members/courses/headshot-photography-tutorials/

    Thanks for a hint if this is possible to solve.

    Cheers,
    Dan

    • This topic was modified 1 year, 9 months ago by DanHostettler45 DanHostettler45. Reason: formatting
    • This topic was modified 1 year, 9 months ago by DanHostettler45 DanHostettler45. Reason: formatting 2
    • This topic was modified 1 year, 9 months ago by DanHostettler45 DanHostettler45. Reason: formatting 3
    #30101
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi,

    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 );

    ..and..

    $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,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #30148
    DanHostettler45
    DanHostettler45
    Participant

    Hi Ernest,

    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.

    Best;

    Dan

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.