[wp-hackers] Include in functions.php
cross at thisismyurl.com
Tue Nov 15 18:48:39 UTC 2011
Is it an external PHP? If so, my suggestion is to create a new folder in your theme directory and then include this code in your functions.php file (change the file name and directory as needed) .
$function_include = dirname( __FILE__ ) . '/external/example.php' ;
if ( file_exists( $function_include) ) require_once( $function_include );
that way, you can update the script later without affecting your functions.php file. If it'll always exist, you can skip the test.
On 2011-11-15, at 1:41 PM, Pasquale Puzio wrote:
> Hi guys,
> I would import an external script in a custom function hooked to a
> WordPress action.
> Unfortunately, the include function seems to have some problems. So I'm not
> able to use the functions defined in the script.
> What's the best way to include an external script in WordPress?
> Dott. Pasquale Puzio
> info at pasqualepuzio.it
> 340 5026359
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
christopher.ross at rodonic.com
Toll Free (855) RODONIC
We build websites.
More information about the wp-hackers