admin管理员组文章数量:1287597
In my wordpress functions.php I have calls to include other function files. For example like so:
include("functions/articles.php");
include("functions/custompost.php");
Within those files I have all my functions that pertain to specific pages on the site.
What I want to do is this:
//Articles custom functions
function articles_fn() {
if ( is_page_template( 'page_templates/articles.php' ) ) {
include("functions/articles.php");
}
}
add_action( 'init', 'articles_fn');
//CustomPostType custom functions
function cpt_fn() {
if ( is_page_template( 'page_templates/custompost.php' ) ) {
include("functions/custompost.php");
}
}
add_action( 'init', 'cpt_fn');
...but this doesn't work. Any help is hugely appreciated.
Thank you
本文标签: embedWordpress functionsphp conditional include another functions file
版权声明:本文标题:embed - Wordpress functions.php conditional include another functions file 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741262478a2367878.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论