Title: Custom template won&#8217;t load
Last modified: April 19, 2018

---

# Custom template won’t load

 *  Resolved [Nick Young](https://wordpress.org/support/users/nickyoung87/)
 * (@nickyoung87)
 * [8 years, 2 months ago](https://wordpress.org/support/topic/custom-template-wont-load/)
 * Hello,
 * I am having an issue getting a custom template to load. I have already viewed
   the recently closed topic here: [https://wordpress.org/support/topic/template-doesnt-change/](https://wordpress.org/support/topic/template-doesnt-change/)
 * But that did not help.
 * I have also looked around for other solutions but have not been able to find 
   out why it’s not working.
 * Here is a gist of the functions.php function I am using: [https://gist.github.com/nickyoung87/73c6190f73755096a2595dd0ecdeb03c](https://gist.github.com/nickyoung87/73c6190f73755096a2595dd0ecdeb03c)
 * Other info:
    – WordPress version is the latest version – WPSL is the only plugin
   activated and is using the latest version – Using Twenty Seventeen theme (no 
   child) – I have setup the Google API keys – I have set the custom template from
   the dropdown in the settings – I have made sure the custom template file does
   in fact exist in the theme folder at the correct location – No console errors
   present – Tried changing the priority on the filter to 99 just in case it was
   conflicting somehow with another filter even though there is not any. – Fails
   both on my localhost setup and on the live website example provided. – I tried
   sprinkling a few debugging output lines in the plugin. One in particular that
   confused me was in the `class-templates.php` file in the function `get_default_template`.
   It was always outputting `store_locator` as the type for me. – Also in `class-
   templates.php` the function `get_template_details` was always outputting the `
   below_content` value for the `$used_template` variable.
 * Not sure if that is helpful with the debugging as I didn’t dig super deep to 
   trace everything and find out if that was even related to the issue, but just
   something I noticed and thought I should point out in case it does help.
 * My only other concern is maybe there is something wrong with my template file?
   Right now I just have one line of PHP in there to test it: `echo 'TESTING';` 
   but I have tried copying the default template from the plugin folder and making
   small changes and that still didn’t seem to change it.
 * Any thoughts or suggestions here?
 * Look forward to your response, thanks!
    -  This topic was modified 8 years, 2 months ago by [Nick Young](https://wordpress.org/support/users/nickyoung87/).
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fcustom-template-wont-load%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

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

 *  Plugin Author [Tijmen Smit](https://wordpress.org/support/users/tijmensmit/)
 * (@tijmensmit)
 * [8 years, 2 months ago](https://wordpress.org/support/topic/custom-template-wont-load/#post-10206423)
 * Can you include the code below on line [715 here](https://plugins.trac.wordpress.org/browser/wp-store-locator/tags/2.2.10/frontend/class-frontend.php#L715),
   and check if the path is correct.
 *     ```
       echo $template_details['path'];
       exit();
       ```
   
 *  Thread Starter [Nick Young](https://wordpress.org/support/users/nickyoung87/)
 * (@nickyoung87)
 * [8 years, 2 months ago](https://wordpress.org/support/topic/custom-template-wont-load/#post-10207268)
 * The line 715 that you linked me to is in version 2.2.10 and I am currently running
   2.2.14 so that line is a bit different. I am going to try reverting to 2.2.10
   and see if that helps and then report back here.
 * If not then it looks like the new line would be around 694 in 2.2.14 correct?
 *  Thread Starter [Nick Young](https://wordpress.org/support/users/nickyoung87/)
 * (@nickyoung87)
 * [8 years, 2 months ago](https://wordpress.org/support/topic/custom-template-wont-load/#post-10207756)
 * Ok so it doesn’t work for me on 2.1.10 either I just finished checking.
 * While I have it installed though I added the code you suggested and got this:
 * `Notice: Undefined variable: template_details in /home/nyoung87/public_html/plugins/
   wp-content/plugins/wp-store-locator/frontend/class-frontend.php on line 718`
 * So I changed it to this:
 *     ```
       echo $template_path;
       exit();
       ```
   
 * And that got me this:
 * `/home/nyoung87/public_html/plugins/wp-content/plugins/wp-store-locator/frontend/
   templates/store-listings-below.php`
 * So it is always calling the `below` template it looks like.
 *  Thread Starter [Nick Young](https://wordpress.org/support/users/nickyoung87/)
 * (@nickyoung87)
 * [8 years, 2 months ago](https://wordpress.org/support/topic/custom-template-wont-load/#post-10207760)
 * Oh my gosh I am an idiot and I am sorry to waste your time. I just double checked
   the shortcode on the page and it was using the template attribute. Removed that
   and we are all good now.
 * So sorry and thanks for the plugin!
 *  Plugin Author [Tijmen Smit](https://wordpress.org/support/users/tijmensmit/)
 * (@tijmensmit)
 * [8 years, 1 month ago](https://wordpress.org/support/topic/custom-template-wont-load/#post-10208976)
 * Well, that happens to me sometimes as well when I test code. Setting a template
   through the shortcode and wondering why it doesn’t use the selected template 
   from the settings page 🙂

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

The topic ‘Custom template won’t load’ is closed to new replies.

 * ![](https://ps.w.org/wp-store-locator/assets/icon-256x256.jpg?rev=1007784)
 * [WP Store Locator](https://wordpress.org/plugins/wp-store-locator/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-store-locator/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-store-locator/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-store-locator/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-store-locator/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-store-locator/reviews/)

 * 5 replies
 * 2 participants
 * Last reply from: [Tijmen Smit](https://wordpress.org/support/users/tijmensmit/)
 * Last activity: [8 years, 1 month ago](https://wordpress.org/support/topic/custom-template-wont-load/#post-10208976)
 * Status: resolved