admin管理员组文章数量:1326633
I understand that you can create (as per the WordPress Hierarchical Structure) a specific template to load a specifc template.
For example:
category-new-york.php
^ this is a priority over simply:
category.php
My question is, would creating a template PER US State be a "bad idea?"
So, I would have:
category-alabama.php
category-arizona.php
category-akansas.php
etc etc
I say "bad practice" because perhaps I am just adding a ton of overhead that WordPress has to loop through templates - or is it not a huge problem? Would the overhead be nominal?
Thanks
I understand that you can create (as per the WordPress Hierarchical Structure) a specific template to load a specifc template.
For example:
category-new-york.php
^ this is a priority over simply:
category.php
My question is, would creating a template PER US State be a "bad idea?"
So, I would have:
category-alabama.php
category-arizona.php
category-akansas.php
etc etc
I say "bad practice" because perhaps I am just adding a ton of overhead that WordPress has to loop through templates - or is it not a huge problem? Would the overhead be nominal?
Thanks
Share Improve this question asked Aug 5, 2020 at 12:49 HenryHenry 9831 gold badge8 silver badges31 bronze badges1 Answer
Reset to default 1I say "bad practice" because perhaps I am just adding a ton of overhead that WordPress has to loop through templates - or is it not a huge problem? Would the overhead be nominal?
No, there won't be an extra performance cost because that's not how the template loading works. WP always runs through the template hierarchy from most specific to most generic, testing if the file exists as it goes along. It doesn't "loop" through them.
As for creating a template for every US state, I would advise against it, mainly because it means your folder will have a lot of files making it difficult to navigate in the editor, and when you want to make a change you have to update every single state.
You'd be better off making a single generic state template, or better yet, add a state taxonomy and create taxonomy-state.php
instead of repurposing categories.
本文标签: categoriesHaving a template per category Bad for server overhead
版权声明:本文标题:categories - Having a template per category? Bad for server overhead? 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742209870a2433510.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论