Support Forum

Codex little error in Creating a Theme procedure

SP SPQC
SPQC
Member

Was giving a go at http://codex.simple-press.com/codex/themes/theme-basics/creating-a-theme/ and found an error.  In step 3 you tell us to rename ‘default.php’ to the same name of our theme and it step 4 you say You can edit any other information in the spTheme.txt file you wish but the first line, naming your theme, is the only needed change.  What’s missing is that the line stylesheet: default.php is also important, unless you skip step 3.

13 Answers

New Answer

MP Mr Papa
Mr Papa
Member

that is probably a good put and we can clarify that a bit…

BR Brandon
Brandon
Member

SPQC said

Was giving a go at http://codex.simple-press.com/codex/themes/theme-basics/creating-a-theme/ and found an error. 

Good catch. I added more info to that section and included the php file name change.

Thanks for the heads up.

SP SPQC
SPQC
Member

The screenshot show 1.0.10!  Must be coming with next update…  🙂  Where is the changelog?  wink

 

Also I want to report a little something now that I created my theme folder.  Whenever I switch back & forth between Default theme and mine, with the Activate button, there is a message that shows up at the top which is :

 

Fatal error: Cannot redeclare spdefault_textdomain() (previously declared in /wp/wp-content/sp-resources/forum-themes/SPQC/templates/spFunctions.php:17) in /wp/wp-content/sp-resources/forum-themes/default/templates/spFunctions.php on line 18


This don’t seem to have any impact but I’m telling you, just in case you know what’s going on.  Note that if I click Update Overlay, the message don’t show up.

MP Mr Papa
Mr Papa
Member

yes, since 1.0.9 of the themes was updated, any new version will be 1.0.10…  and we do have a few minor mods – mostly cleanup…

please note, that codex page walked you through changing the spFunctions.php file so you wont get that error… you need to make changes in there…

MP Mr Papa
Mr Papa
Member

spDefault is the textdomain for our default theme… you need to make your own for your own theme…

MP Mr Papa
Mr Papa
Member

right before ‘try your new theme’… that step about editing spFunctions.php

SP SPQC
SPQC
Member

That did it…  the 1st time I actually did it, then realized that I lost the translations so I reverted back to original and forgot.  oops!

 

So I did it like stated, which gives :

 

add_action(‘init’, ‘spSPQC_textdomain’);

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

 

What’s wrong?

MP Mr Papa
Mr Papa
Member

so what’s the problem? still getting the error?

SP SPQC
SPQC
Member

If I use the code above, no, no errors but translation is broken.  That’s why I reverted back and was having the rrror message but at least the translations were there.

MP Mr Papa
Mr Papa
Member

well, if you create your own theme, you have to have your own translations… the translation for our default theme, uses the spDefault textdomain…

when you change spDefault to spSPQC, you have created your own textdomain for localizations, so you cannot use the translations from the sp default theme…

YS Yellow Swordfish
Yellow Swordfish
Member

But renaming the .mo file as well should still work assuming the text strings have remained the same

SP SPQC
SPQC
Member

Ok, I renamed it and it works.  That part was missing in the instructions, maybe add a little note about it?

MP Mr Papa
Mr Papa
Member

the problem with telling folks to rename it would be if you changed some strings… say you wanted to reword some of the strings… renaming the file would not work since changing strings would have changed…

we might could add a note if no strings were modified you could reuse our translations… but hard to make clear the interactions…