Cannot call function from Functions.php in template

Question

I have a custom php file in wp-content/themes/xxxx/modules/custom.php and i want to call function from Functions.php. Right now all my functions (same function) everywhere in different files, because still cannot solve this problem.

I want to create a function in Functions.php and call this function from everywhere in the website. This function will called from another php files (Ajax will not call this function). When I include or require any file (wp-load, wp-blog-header, functions.php are not imported)

I read many forums and tried many ways like

1.

define('WP_USE_THEMES', true);
require( '/opt/bitnami/apps/wordpress/htdocs/wp-blog-header.php' ); 

2.

include (/opt/bitnami/apps/wordpress/htdocs/wp-content/themes/xxx/functions.php);

3.

require($_SERVER['DOCUMENT_ROOT'] . '/wp-load');
require(/opt/bitnami/apps/wordpress/htdocs/wp-load');

etc. I tried many ways but all examples not working.

Is there any way to declare a function in Funtions.php and use everywhere without any problem?.

0
, Bayanaa 2 years 2019-04-25T17:02:13-05:00 0 Answers 78 views 0

Leave an answer

Browse
Browse