[wp-hackers] Include in functions.php
Christopher Ross
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.
Chris
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?
>
> Thanks
>
> --
> Dott. Pasquale Puzio
> http://www.pasqualepuzio.it
> info at pasqualepuzio.it
> 340 5026359
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
--
Christopher Ross
christopher.ross at rodonic.com
http://rodonic.com
Toll Free (855) RODONIC
We build websites.
More information about the wp-hackers
mailing list