• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

QUESTION Include php class file

kepler

New member
Messages
2
Likes
0
Points
1
#1
Greetings

Is it possible to include (or require) a php file that contains a class? What is the best method to do this? Place the file somewhere in the plugin path, and call it by the dir path? Or is it possible to create the class?

Any sugestions are welcome.

Best regards

Kepler
 

Temyk

Support team
Staff member
Messages
538
Likes
26
Points
28
#2
Hello.

You can place a php file anywhere and connect it in a snippet.
PHP:
include_once ABSPATH."my_scripts/file.php";
ABSPATH - the path to the root folder of wordpress
 

kepler

New member
Messages
2
Likes
0
Points
1
#3
Greetings

Thanks for the reply. It's quite handing I must say :) This is the best tool I've found for Wordpress.

Best regards

Kepler