Child Theme problem - Fatal error: Cannot redeclare cp_new_ad_email()
I'm developing a child theme for a ClassiPress website.
I want to modify the
cp_contact_ad_owner_email() function in
theme-emails.php. Nothing major, I just want to output a user inputed phone number in the Email which that file generates.
So I copied the function to my child theme's function.php and made the modification but get this error:
Code:
Fatal error: Cannot redeclare cp_new_ad_email()
No surprise there, Wordpress cannot have two functions of the same name. To overcome this the conditional statement
if (!function_exists()) is required in the parent theme before each function is declared.
I see ClassiPress has some support for this, but obviously not as much as I hoped. Should this be already written into the theme-emails.php as people may not wish to send the default Emails and thus easy child theme modification be convenient?
Ok, it's no problem for me to add that code to the parent ClassiPress theme but
it defeats the purpose of developing a child theme! I might as well just modify the orignal ClassiPress files.
From my understanding, before a function can be "overwritten" in a Child theme the parent theme must first use the if (!function_exists()) conditional statement, which is something the theme developers must incorporate into their theme.
Could somebody with development experience please tell me if there is another way around this?