Get template part vs locate template function

First of all note that get_template_part internally uses locate_template, so your feeling that the latter is slower is wrong. If you look at the code, get_template_part is little more than a wrapper for locate_template, so if one work and the other not, there are 2 possibilities: you are using get_template_part wrong there’s some hook on … Read more

Template files missing after moving site

Sounds like it could be an issue with the database and serialization of the plugin options. I’ve had problems before with plugin settings etc when moving a site using the xml export. The category templates plugin writes a lot of options to the db and they could be corrupted. As a test try creating a … Read more

How to create tag.php

Unfortunately all of your code is wrong. What you are doing is the same as query_posts, which should never be used. Also, never swap the main query on any type of archive page or on the home page for a custom query To create a tag page, just simply make a copy of your index.php, … Read more

stop blog page from using index.php?

Please consult the Template Hierarchy, and ensure that you are using the correct names for template files. index.php should be left as the default fallback for all other template files The site front page template file name is front-page.php. You need to rename your homepage.php as front-page.php The blog posts index page template file name … Read more

Where to store some per-template preferences?

If the options have “visual” impact on the website, consider using the customizer, it gives immediate visual feedback on what changing a value means. If the settings have no visual impact on the website, then maybe they don’t belong in the theme after all, but in a separate plugin. There are always edge cases, so … Read more

Child Theme: how to override variables?

I’m mobile, so this will be short. Use the after_setup_theme hook to add a function to set those variables. Declare them as global inside that function before setting them. Hope that helps. If anybody wants to add an example to this answer before I get home, feel free. 😉