Support Forum

Error message when switching themes

CF Conrad_Farlow
Conrad_Farlow
Member

When switching between my theme and the default in the Admin dashboard I get the following message:

Fatal error: Cannot redeclare spdefault_textdomain() (previously declared in /problem-with-post-edit-buttonome/gruzcom1/public_html/ABF_Test/wp-content/sp-resources/forum-themes/cTheme/templates/spFunctions.php:18) in /problem-with-post-edit-buttonome/gruzcom1/public_html/ABF_Test/wp-content/sp-resources/forum-themes/default/templates/spFunctions.php on line 19

Despite this error the switch seems to be successful, I have checked the sPFunctions.php file and it looks the same as the one in the default theme, any ideas what this might be?

Conrad

10 Answers

New Answer

CF Conrad_Farlow
Conrad_Farlow
Member

Definitely the same in both spFuntions.php files, looks as though it is whatever declares the default font, none critical but you don’t want to see any message that says fatal error!

 

Conrad

YS Yellow Swordfish
Yellow Swordfish
Member

It’s harmless but was also fixed up several days ago? Have you not updated your theme folder from svn recently?

CF Conrad_Farlow
Conrad_Farlow
Member

I always do all 3 categories when I svn up. However I am using my theme and the error came when I switched from my theme to the default theme. I had better spend a few days doing some file comparing.

LH Lee H
Lee H
Member

@Conrad

It might be that “plugin” for the time format we were messing with? Also, in case you haven’t noticed Andy made that change making time and date stackable so that plugin is redundant now anyway.

CF Conrad_Farlow
Conrad_Farlow
Member

I have replaced the all the template files from my theme with the contents of the recently updated default theme. I still see the error, any idea where else I should look Andy?

Conrad

YS Yellow Swordfish
Yellow Swordfish
Member

It is simply the name of the function setting the localisation in the theme spFunctions.php file. If you copied it from one iof ours then it will have the same function name. For that brief period when you switch themes, both are loaded causing the duplicate function name warning. Not sure there is anything we can do about this other than to recommend people use a unique function name for that call – preferably including the theme name in the function name as we have done.

CF Conrad_Farlow
Conrad_Farlow
Member

So where are the locations where I need to rename it? Is it only called at load up from the spFunctions.php file?

YS Yellow Swordfish
Yellow Swordfish
Member

It is this code:

add_action(‘init’, ‘spDefault_textdomain’);

# load the theme textdomain for tranlations
function spDefault_textdomain() {
    sp_theme_localisation('spDefault');
}

This is from the spDefault theme. The name is in the add_action and then is the name of the function. They both need changing and as I say, we would recommend changing them to match the theme name chosen.

CF Conrad_Farlow
Conrad_Farlow
Member

I never did sort this out can you be really specific and tell me exactly what to do? My theme has been named Riverbed 1.0, I think that I have done this correctly as this is how it appears in the available Themes panel. It also works fine I just get the message when switching. Yes I did copy your default theme initially and the 2 spFunctions files are identical. Where and what exactly should I rename?

Sorry I’m feeling particularly dense this week I’ve been running simulations of antennas for weeks at work and my brain is totally fried!

Conrad

MP Mr Papa
Mr Papa
Member

in your theme, look in the functions.php template file… at the top you will see – or at least should not see this:

add_action(‘init’, ‘spDefault_textdomain’);

# load the theme textdomain for tranlations
function spDefault_textdomain() {
    sp_theme_localisation(‘spDefault’);
}

that will be duplicate of the default theme… you need to make it specific for your theme… ie replace spDefault_ with Riverbed_ for example