• doowayne

    (@doowayne)


    Hello,

    I want to change the layout of the search results for my website. To do so, I did as instructed in the plugin’s documentation : I added a relevanssi-live-ajax-search folder to my theme repertory, copied the search-result.php template there and applied my modifications in that file.

    The issue is that those changes are not applied on the front end. It seems that the plugin template is not overridden by my own. I tried to do the same thing with search-results-query.php, but it doesn’t work either.

    Is there any step I am missing here ?

    Thank you in advance for your help.

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

    (@msaari)

    No, that’s all it should take. Ensure the directory name is spelled correctly. And you’re certain your site is using Relevanssi Live Ajax Search, and not a theme Ajax search? Sorry if this sounds like a stupid question, but I’ve seen that case so many times I have to ask.

    Thread Starter doowayne

    (@doowayne)

    Thank you for your response.

    I double-checked and the repertory is correctly named, and the website is not using any other Ajax search.

    I tried modifying the templates directly from the extension repertory on a local environment, and it appears that the on that is used to display the results is search-results-query.php. But it also doesn’t work when I put search-results-query.php in my theme’s repertory.

    Plugin Author Mikko Saari

    (@msaari)

    You can use the relevanssi_live_search_results_template filter hook to investigate this: this hook will show you the location where Live Ajax Search is loading the template from.

    add_filter( 'relevanssi_live_search_results_template', function( $location ) {
    error_log( $location );
    return $location;
    } );

    This will print out the location of the template to the error log when you search. What does that say?

    Thread Starter doowayne

    (@doowayne)

    This is what I get when using this filter hook :

    [01-Jan-2025 19:18:13 UTC] C:\wamp64\www\doc_center\wp-content\plugins\relevanssi-live-ajax-search/templates/search-results-query.php
    Plugin Author Mikko Saari

    (@msaari)

    Ok, so it’s not picking up the template. Since you’re using WAMP, I wouldn’t rule that out as an explanation.

    You can use the filter to change the path to the template in your theme.

    Thread Starter doowayne

    (@doowayne)

    I used the filter like this :

    add_filter( 'relevanssi_live_search_results_template', function(){ return dirname( __file__) . "/relevanssi-live-ajax-search/search-results.php";} );

    But the following error occurs when using the search bar :

    Warning: include(C:\wamp64\www\doc_center\wp-content\themes\knowledgebase\relevanssi-live-ajax-search\search-results.php): Failed to open stream: No such file or directory in C:\wamp64\www\doc_center\wp-content\plugins\relevanssi-live-ajax-search\includes\class-relevanssi-live-search-client.php on line 76

    It also doesn’t work on the online version.

    Am I not using the correct path ?

    Plugin Author Mikko Saari

    (@msaari)

    That seems correct, but I cannot tell where the template file is on your hard drive. Is the file there? If the file isn’t there (or isn’t readable for some other reason), that would explain why replacing the template didn’t work in the first place.

Viewing 7 replies - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.