admin管理员组文章数量:1130349
We began this project without using wordpress, and have a significant amount of code related to user and access control that we would like included on CERTAIN pages in the site (namely the shop). We are using woocommerce as our cart, and we need to have the ability to connect our existing database of users to the site so that non employees can still use the front end while the shop that we want to create using woocommerce will only be accessible to people who have an account on the employee portal. The Directory for all the non-wordpress is in a folder below wordpress, or in other words, wordpress is at the root, and our project is in a directory below the root.
We began this project without using wordpress, and have a significant amount of code related to user and access control that we would like included on CERTAIN pages in the site (namely the shop). We are using woocommerce as our cart, and we need to have the ability to connect our existing database of users to the site so that non employees can still use the front end while the shop that we want to create using woocommerce will only be accessible to people who have an account on the employee portal. The Directory for all the non-wordpress is in a folder below wordpress, or in other words, wordpress is at the root, and our project is in a directory below the root.
Share Improve this question asked Oct 26, 2018 at 20:47 Tyler LazenbyTyler Lazenby 1033 bronze badges1 Answer
Reset to default 0It's not clear where you need to add this additional code. But I would assume that it is in 'include'-type files that you need to run in the portion of the generated page.
So, to do that, use the add_action('wp_head','your-function-name') to load your external function file:
add_action('wp_head','include_my_include');
function include_my_include() {
include get_template_directory() . 'your-function-file.php';
return;
}
See here: https://codex.wordpress/Function_Reference/get_template_directory .
This code would be in your theme's (Child Theme, hopefully) function.php file.
We began this project without using wordpress, and have a significant amount of code related to user and access control that we would like included on CERTAIN pages in the site (namely the shop). We are using woocommerce as our cart, and we need to have the ability to connect our existing database of users to the site so that non employees can still use the front end while the shop that we want to create using woocommerce will only be accessible to people who have an account on the employee portal. The Directory for all the non-wordpress is in a folder below wordpress, or in other words, wordpress is at the root, and our project is in a directory below the root.
We began this project without using wordpress, and have a significant amount of code related to user and access control that we would like included on CERTAIN pages in the site (namely the shop). We are using woocommerce as our cart, and we need to have the ability to connect our existing database of users to the site so that non employees can still use the front end while the shop that we want to create using woocommerce will only be accessible to people who have an account on the employee portal. The Directory for all the non-wordpress is in a folder below wordpress, or in other words, wordpress is at the root, and our project is in a directory below the root.
Share Improve this question asked Oct 26, 2018 at 20:47 Tyler LazenbyTyler Lazenby 1033 bronze badges1 Answer
Reset to default 0It's not clear where you need to add this additional code. But I would assume that it is in 'include'-type files that you need to run in the portion of the generated page.
So, to do that, use the add_action('wp_head','your-function-name') to load your external function file:
add_action('wp_head','include_my_include');
function include_my_include() {
include get_template_directory() . 'your-function-file.php';
return;
}
See here: https://codex.wordpress/Function_Reference/get_template_directory .
This code would be in your theme's (Child Theme, hopefully) function.php file.
本文标签: customizationIncluding a Customized Initialize File with a wordpress header
版权声明:本文标题:customization - Including a Customized Initialize File with a wordpress header 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://it.en369.cn/questions/1749229367a2336205.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。


发表评论