• Resolved SeeJaneB

    (@janiebee83)


    I have noticed weird behavior on the front end of my search results pages.

    In my Oxygen Search Results template, it defaults to the display of a search for the word “post” and also inherits the header and footer of the Main template, which contains a menu. See screenshot: https://www.awesomescreenshot.com/image/9072923?key=96253831a6125625eaf312c76cb697ee

    On the front end of the site, if I perform a search from the search form in my menu for any word other than “post,” the search results are displayed properly, but the menu in the header disappears. If I search for the term “post” then the menu remains in the header. Here is a short video to show you: https://www.awesomescreenshot.com/video/4021407?key=fa3084d89dbdbe09727a1496c2d0c821

    I first reached out to Oxygen Builder support thinking it was an Oxygen issue, but after investigating, this was their reply:

    “The problem you are experiencing seems to be caused by the Relevanssi plugin. If you disable it, then clear the SG Cache, you will see that your menu is still visible when you perform a search.

    I would suggest reaching out to the developers of the Relevanssi plugin as they would need to investigate why having their plugin active is causing the menu to disappear when using most search terms.”

    Can you help me, please?

    The page I need help with: [log in to see the link]

Viewing 12 replies - 1 through 12 (of 12 total)
  • Plugin Author Mikko Saari

    (@msaari)

    Nothing to do with Oxygen, indeed. You’re using Max Mega Menu, and Relevanssi removes Max Mega Menu shortcodes from posts when building excerpts because they have a tendency to break the excerpts.

    Add this to a code snippet:

    add_filter( 'relevanssi_page_builder_shortcodes', 'rlv_unremove_maxmegamenu' );
    function rlv_unremove_maxmegamenu( $shortcodes ) {
        return array_filter( $shortcodes, function( $shortcode ) { return $shortcode !== '/\[maxmegamenu.*?\]/im'; } );
    }

    This should return the menu.

    • This reply was modified 3 years, 5 months ago by Mikko Saari.
    Thread Starter SeeJaneB

    (@janiebee83)

    @msaari I added the code snippet but I’m not seeing any change. The menu still doesn’t display in the header on search results.

    Plugin Author Mikko Saari

    (@msaari)

    How about this?

    add_filter( 'relevanssi_disable_shortcodes_excerpt', function ( $shortcodes ) {
        return array_filter( $shortcodes, function( $shortcode ) { return $shortcode !== 'maxmegamenu'; } );
    } );
    Thread Starter SeeJaneB

    (@janiebee83)

    @msaari that didn’t seem to work either.

    Plugin Author Mikko Saari

    (@msaari)

    Well, if that doesn’t help, I don’t know what else will… Just checking, how did you add the latter code? I wonder if it can be a question of wrong priorities, the code being applied too late or something like that?

    Where is the menu placed? Is it placed with the [maxmegamenu] shortcode, or in some other way?

    Thread Starter SeeJaneB

    (@janiebee83)

    @msaari I used the Code Snippets plugin and checked the option to have it run everywhere. I tried at first to just have it run on the front end, but when that didn’t work, I switched it to everywhere, but still didn’t have results.

    The max mega menu is placed in the header portion of my template with the shortcode:
    [maxmegamenu location=max_mega_menu_1]

    Plugin Author Mikko Saari

    (@msaari)

    Ok, let’s try a really strong measures. Edit the file lib/indexing.php in Relevanssi and remove the line that looks like this:

    'maxmegamenu', // Max Mega Menu.

    It’s in the function relevanssi_disable_shortcodes(), somewhere around line 1575. Just remove the whole line. Does that solve this problem?

    Thread Starter SeeJaneB

    (@janiebee83)

    Sorry for the delay. Yes. That solves it. So should I go ahead and delete the other code snippets that didn’t work?

    And also moving forward, when the plugin updates, will I need to go in and remove this code each time?

    Plugin Author Mikko Saari

    (@msaari)

    That’s one approach, but try one more thing:

    add_filter( 'relevanssi_disabled_shortcodes', function ( $shortcodes ) {
        return array_filter( $shortcodes, function( $shortcode ) { return $shortcode !== 'maxmegamenu'; } );
    } );

    Does this work any better?

    Thread Starter SeeJaneB

    (@janiebee83)

    Do you want me to put the lib/indexing.php file back the way it was and then try this other method?

    And where am I adding this? as a code snippet (given that I’m using Oxygen Builder)?

    Plugin Author Mikko Saari

    (@msaari)

    Yes, otherwise you won’t be able to see whether it works or not. Code snippet is a good place for this.

    Thread Starter SeeJaneB

    (@janiebee83)

    This seems to be working, as well. Thank you so much!

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Search Template Display Issue’ is closed to new replies.