Title: Customize autocomplete template without using theme location?
Last modified: August 7, 2022

---

# Customize autocomplete template without using theme location?

 *  Resolved [theblueli](https://wordpress.org/support/users/theblueli/)
 * (@theblueli)
 * [3 years, 10 months ago](https://wordpress.org/support/topic/customize-autocomplete-template-without-using-theme-location/)
 * Hello, my site is built by Oxygen Builder which requires no wp theme to work.
   In this case, is it possible for this filter to hook my template in a custom 
   location like the /uploads/ folder?
 * I have tried the below code but does not seem to work.. Thanks
 *     ```
       function yourtheme_algolia_template_locations( array $locations, $file ) {
           if ( $file === 'autocomplete.php' ) {
               $locations[] = '/wp-content/uploads/wp-search-with-algolia/templates/autocomplete.php';
           } 
           return $locations;
       }
   
       add_filter( 'algolia_template_locations', 'yourtheme_algolia_template_locations', 10, 2 );
       ```
   

Viewing 5 replies - 1 through 5 (of 5 total)

 *  Plugin Contributor [Michael Beckwith](https://wordpress.org/support/users/tw2113/)
 * (@tw2113)
 * The BenchPresser
 * [3 years, 10 months ago](https://wordpress.org/support/topic/customize-autocomplete-template-without-using-theme-location/#post-15898087)
 * Looking at a reply from 9 months ago over at [https://wordpress.org/support/topic/customing-templates-when-theming-is-disabled/#post-14964278](https://wordpress.org/support/topic/customing-templates-when-theming-is-disabled/#post-14964278),
   this topic isn’t as simple as it ideally would be.
 * Also a person after my reply mentioned some issues regarding things like `get_header()`
   and `get_footer()`, so something to keep in mind.
 * Alternatively, I wonder if you’d be able to create an Oxygen Builder template
   in their setup, that holds the markup portions from the templates, and then load
   all of the javascript portions through the enqueue scripts system.
 *  Thread Starter [theblueli](https://wordpress.org/support/users/theblueli/)
 * (@theblueli)
 * [3 years, 9 months ago](https://wordpress.org/support/topic/customize-autocomplete-template-without-using-theme-location/#post-15930303)
 * > to create an Oxygen Builder template in their setup, that holds the markup 
   > portions from the templates, and then load all of the javascript portions through
   > the enqueue scripts system.
 * Hi sorry for the late reply. I am not very techy.. wish I could understand what
   you mean. I think I should give it up.. have tried some other way but with no
   success. I just want to change the No results matched your query into another
   language. I edit the plugin template directly…any update I just go there and 
   change the lines again.
 * I am trying to make the text a different language as the site is a multi-language
   site. I did something like this below doesn’t the condition does not work. Does
   not seem to be the question related to the plugin. Hope you don’t mind me asking…
   if we want to use a WP function like this one get_locale(). Usually, how should
   we do that? Thanks
 *     ```
       <script type="text/html" id="tmpl-autocomplete-empty">
       	<div class="autocomplete-empty">
       		<?php 
       			$current_language = get_locale();
       			if ($current_language = zh_HK){
       			echo esc_html_e( '沒有結果符合您的查詢 ', 'wp-search-with-algolia' ); 
       			}elseif ($current_language = en_HK){
       			echo esc_html_e( 'No results matched your query ', 'wp-search-with-algolia' ); 
       			}
       		?>
       		<span class="empty-query">"{{ data.query }}"</span>
       	</div>
       </script>
       ```
   
 *  Plugin Contributor [Michael Beckwith](https://wordpress.org/support/users/tw2113/)
 * (@tw2113)
 * The BenchPresser
 * [3 years, 9 months ago](https://wordpress.org/support/topic/customize-autocomplete-template-without-using-theme-location/#post-15933454)
 * At bare minimum, you’d want 2 equal signs, meaning `==` and not single `=` because
   that assigns the variable. Also won’t hurt to wrap the language codes in quotes
   to ensure it’s evaluated as a string.
 *     ```
       if ($current_language == 'zh_HK'){
       	echo esc_html_e( '沒有結果符合您的查詢 ', 'wp-search-with-algolia' ); 
       }elseif ($current_language == 'en_HK'){
       	echo esc_html_e( 'No results matched your query ', 'wp-search-with-algolia' ); 
       }
       ```
   
 *  Thread Starter [theblueli](https://wordpress.org/support/users/theblueli/)
 * (@theblueli)
 * [3 years, 9 months ago](https://wordpress.org/support/topic/customize-autocomplete-template-without-using-theme-location/#post-15933502)
 * Yes, it works!! Thank you for correcting the mistake!!
 *  Plugin Contributor [Michael Beckwith](https://wordpress.org/support/users/tw2113/)
 * (@tw2113)
 * The BenchPresser
 * [3 years, 9 months ago](https://wordpress.org/support/topic/customize-autocomplete-template-without-using-theme-location/#post-15936800)
 * Welcome

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Customize autocomplete template without using theme location?’ is closed
to new replies.

 * ![](https://ps.w.org/wp-search-with-algolia/assets/icon-256x256.png?rev=2894668)
 * [WP Search with Algolia](https://wordpress.org/plugins/wp-search-with-algolia/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-search-with-algolia/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-search-with-algolia/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-search-with-algolia/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-search-with-algolia/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-search-with-algolia/reviews/)

 * 5 replies
 * 2 participants
 * Last reply from: [Michael Beckwith](https://wordpress.org/support/users/tw2113/)
 * Last activity: [3 years, 9 months ago](https://wordpress.org/support/topic/customize-autocomplete-template-without-using-theme-location/#post-15936800)
 * Status: resolved