customization - Including a Customized Initialize File with a wordpress header

admin2025-06-07  13

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 badges
Add a comment  | 

1 Answer 1

Reset to default 0

It'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.

转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1749229392a317447.html

最新回复(0)