Re: include() and duplicate function definition

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 2010-11-04 at 00:00 +0800, David Nelson wrote:
> Hi Thijs, :-)
> 
> On Wed, Nov 3, 2010 at 20:38, Thijs Lensselink <dev@xxxxxxxx> 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 different functionality. So why do you need the original
> > function?
> >
> > Just create your action.php and define the same function.
> 
> It's a WordPress issue. When theme updates become available from the
> original vendor, you can update them from within the admin backend. In
> that case, any hacks you've applied (such as removing a function) get
> overwritten. So the evangelized solution is to create a child theme.
> The child theme incorporates only files that you've added or changed,
> with the original parent theme being used for all others.
> 
> Easy peasy if you want to *add* a function.
> 
> But, if you want to *modify* a function, you're faced with the problem
> of the original function still being present in the parent theme files
> and of your having to define a function of the same name in your child
> theme (if you change the function name, you then have to hack other
> code further upstream, and the work involved becomes not worth the
> bother). Somehow, I would need to make my hacked function *replace*
> the original function, *without* touching the original function...
> 
> It seems like that's not possible and I'll have to find another
> solution... unless my explanation gives you any good ideas?
> 
> Just to put the dots on the I's, the original "actions.php" contains a
> lot of *other* functions that I don't want to touch, and that I do
> want to leave exposed to the updates process. It's just one single
> function I want to hack...
> 
> Sticky problem, huh? :-)
> 
> In any case, thanks for your kind help, :-)
> 
> David Nelson
> 
> P.S. Sorry about the direct mails: I keep forgetting to hit the
> "Replly to all" button.
> 


I am curious on how this would work, if for some reason they were using
a different template?   the function you want to "overwrite", wont be
used, and therefore, wouldn't your app/template/whatever be updated
improperly than waht you expect it to be?

Just curious... 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux