Results 1 to 9 of 9

Thread: Child Theme problem - Fatal error: Cannot redeclare cp_new_ad_email()

  1. #1
    Thread Starter
    Junior Member mister_x's Avatar
    Join Date
    Feb 2011
    Location
    Australia
    Posts
    36
    Thanks
    9
    Thanked 3 Times in 3 Posts

    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?

  2. The Following User Says Thank You to mister_x For This Useful Post:

    mnio (February 27th, 2013)

  3. #2
    Thread Starter
    Junior Member mister_x's Avatar
    Join Date
    Feb 2011
    Location
    Australia
    Posts
    36
    Thanks
    9
    Thanked 3 Times in 3 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!

  4. #3
    Thread Starter
    Junior Member mister_x's Avatar
    Join Date
    Feb 2011
    Location
    Australia
    Posts
    36
    Thanks
    9
    Thanked 3 Times in 3 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!

  5. #4
    pepsi's Avatar
    Join Date
    Mar 2009
    Location
    New Zealand
    Posts
    14,887
    Thanks
    91
    Thanked 807 Times in 721 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!

  6. The Following User Says Thank You to pepsi For This Useful Post:

    mister_x (March 10th, 2011)

  7. #5
    Thread Starter
    Junior Member mister_x's Avatar
    Join Date
    Feb 2011
    Location
    Australia
    Posts
    36
    Thanks
    9
    Thanked 3 Times in 3 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!

  8. #6
    Community Partner scarstens's Avatar
    Join Date
    Apr 2010
    Location
    Cave Creek, AZ USA
    Posts
    912
    Thanks
    2
    Thanked 129 Times in 86 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!
    ~ Seth Carstens, Sethmatics Inc.


  9. #7
    Thread Starter
    Junior Member mister_x's Avatar
    Join Date
    Feb 2011
    Location
    Australia
    Posts
    36
    Thanks
    9
    Thanked 3 Times in 3 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!

  10. #8
    Community Partner scarstens's Avatar
    Join Date
    Apr 2010
    Location
    Cave Creek, AZ USA
    Posts
    912
    Thanks
    2
    Thanked 129 Times in 86 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!
    ~ Seth Carstens, Sethmatics Inc.


  11. The Following 2 Users Say Thank You to scarstens For This Useful Post:

    mister_x (March 28th, 2011), rubencio (March 25th, 2011)

  12. #9
    Thread Starter
    Junior Member mister_x's Avatar
    Join Date
    Feb 2011
    Location
    Australia
    Posts
    36
    Thanks
    9
    Thanked 3 Times in 3 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. FATAL ERROR WHILE installing the theme
    By greek01 in forum Report ClassiPress Bugs
    Replies: 1
    Last Post: January 19th, 2011, 02:36 PM
  2. Child Theme - logout redirection to default theme issue
    By cgervereau in forum ClassiPress General Discussion
    Replies: 3
    Last Post: September 1st, 2010, 01:48 AM
  3. Fatal error: Cannot redeclare...
    By rstancato in forum Report ClassiPress Bugs
    Replies: 5
    Last Post: August 22nd, 2010, 07:21 AM
  4. 3.0.1 Fatal error: Cannot redeclare widget_donateplusform()
    By kiltin in forum Help Using ClassiPress
    Replies: 2
    Last Post: April 7th, 2010, 11:31 PM