[PHP] include() and duplicate function definition

2010-11-03 Thread David Nelson
Hi, :-) I'm making a child theme for WordPress. I need to rewrite one function defined in ../sometheme/functions/actions.php and put that rewritten function in wp-content/themes/sometheme-child/functions/actions.php. But I want to preserve ../sometheme/functions/actions.php unchanged in any way.

Re: [PHP] include() and duplicate function definition

2010-11-03 Thread Thijs Lensselink
On Wed, 3 Nov 2010 17:59:06 +0800, David Nelson comme...@traduction.biz wrote: Hi, :-) I'm making a child theme for WordPress. I need to rewrite one function defined in ../sometheme/functions/actions.php and put that rewritten function in

[PHP] include() and duplicate function definition

2010-11-03 Thread David Nelson
Hi Thijs, :-) On Wed, Nov 3, 2010 at 18:18, Thijs Lensselink d...@lenss.nl wrote: As far as I know it is not possible to overwrite functions in PHP (unless you use runkit, apd). Inside classes this is possible. But that's not the case here. Why do the functions have to be equally named? If

Re: [PHP] include() and duplicate function definition

2010-11-03 Thread Peter Lind
You can check with function_exists to see if a function is already defined. If not, create it. Regards Peter On Nov 3, 2010 11:40 AM, David Nelson comme...@traduction.biz wrote: Hi Thijs, :-) On Wed, Nov 3, 2010 at 18:18, Thijs Lensselink d...@lenss.nl wrote: As far as I know it is not

Re: [PHP] include() and duplicate function definition

2010-11-03 Thread David Nelson
Hi Peter, :-) On Wed, Nov 3, 2010 at 18:44, Peter Lind peter.e.l...@gmail.com wrote: You can check with function_exists to see if a function is already defined. If not, create it. The function is definitely already defined, I just need to replace it without touching the file in which it's

Re: [PHP] include() and duplicate function definition

2010-11-03 Thread Peter Lind
That's not going to happen. My point was you could check in the original file if the function is defined and if not then define it. On Nov 3, 2010 11:55 AM, David Nelson comme...@traduction.biz wrote: Hi Peter, :-) On Wed, Nov 3, 2010 at 18:44, Peter Lind peter.e.l...@gmail.com wrote: You can

Re: [PHP] include() and duplicate function definition

2010-11-03 Thread David Nelson
Hi, :-) On Wed, Nov 3, 2010 at 19:29, Peter Lind peter.e.l...@gmail.com wrote: That's not going to happen. My point was you could check in the original file if the function is defined and if not then define it. OK, thanks, Thijs and Peter, it looks like I'm trying to do something that is not

Re: [PHP] include() and duplicate function definition

2010-11-03 Thread Thijs Lensselink
On Wed, 3 Nov 2010 19:53:52 +0800, David Nelson comme...@traduction.biz wrote: Hi, :-) On Wed, Nov 3, 2010 at 19:29, Peter Lind peter.e.l...@gmail.com wrote: That's not going to happen. My point was you could check in the original file if the function is defined and if not then define it.

[PHP] include() and duplicate function definition

2010-11-03 Thread David Nelson
Hi Thijs, :-) On Wed, Nov 3, 2010 at 20:38, Thijs Lensselink d...@lenss.nl wrote: I re-read your original post. And noticed you include the function inside your child action.php Is there a special reason for that? You want to overwrite the original function in a child theme. probably to get

Re: [PHP] include() and duplicate function definition

2010-11-03 Thread Steve Staples
On Thu, 2010-11-04 at 00:00 +0800, David Nelson wrote: Hi Thijs, :-) On Wed, Nov 3, 2010 at 20:38, Thijs Lensselink d...@lenss.nl wrote: I re-read your original post. And noticed you include the function inside your child action.php Is there a special reason for that? You want to

Re: [PHP] include() and duplicate function definition

2010-11-03 Thread David Nelson
Hi guys, :-) Just FYI, I got this answer from the theme dev: David, You don't need the include statement. If you create your function in wp-content/themes/suffusion-child/functions.php it will get automatically included. Secondly, using the same function name wouldn't work, because it would