I want to call a function which is in another php class that I wrote in WordPress. However I’m confused about the syntax, e.g. to get the header on a page you just call get_header(); etc. But how do i call a function in a specific class? For example in index.php I want to call a function named this_function() which reside in say test.php. What is the syntax for this?
I suspect it to be very simple, but I can’t get the syntax right, and I can’t any help online.
Thanks
First use
require_once()
to include the test.php, i.e.Then you can simply call
this-function()
and it will work.You can use this as reference :
http://www.php.net/manual/en/function.require.php