If you have troubles since the update to WordPress 4.5 please read this post before opening a new thread.
Tagged: childtheme translate
February 18, 2011 at 10:00 pm #3123
Trying to translate some txts to my Spanish language in my own child theme.
I’ve setup a child theme of Newscast called “newscast_child”. And runs ok. Now I need to make this child theme to use index.php and archive.php within the child theme folder. So I can change “Red me” txt without further damage.
I read is something like changing de word “TEMPLATEPATH” to “STYLEPATH”¿?
Can you explain?
thanks.February 19, 2011 at 10:31 am #40726
The TEMPLATEPATH looks for a parent theme, the STYLESHEETPATH looks for a child theme folder location, if there is no parent theme (i.e. the theme doesn’t depend on another) then TEMPLATEPATH and STYLESHEETPATH are the same value.
If you want the child theme to use index.php and archive.php just create these files in the CHILD theme. Any missing files are looked up in the PARENT theme before rolling over to index.php if it’s missing. Have a look at the Template Hierarchy for more information on this: http://codex.wordpress.org/Template_Hierarchy
Let me know if you need further clarification or have any other questions.
JamesFebruary 19, 2011 at 1:21 pm #40727
Three files are in the child theme folder with the css:
functions.php, index.php and archive.php.
They are in the child theme and the other are fisically in the parent.
Must I do a replacement in functions.php file with TEMPLATEPATH and STYLESHEETPATH?
Have been translated texts like this “Read more” > “Leer más” in:
../newscast_child/index.php and ../newscast_child/archive.php
as seen below:
If I understood well, child theme should search in current child theme folder before that in parent theme. But it does not.February 20, 2011 at 4:32 pm #40728
Yes. WP searches the child theme folder before the parent folder. If a file can be found in both directories WP will use the child theme file with on exception (functions.php which is used in addition). More information can be found here: http://codex.wordpress.org/Child_ThemesFebruary 21, 2011 at 9:18 am #40729
ok, it should be as described but it doesn’t. Changes made on index and archive are not shown in child theme. Can you tell me how do I modify functions file into child theme to acomplish this?February 22, 2011 at 9:43 am #40730
Sorry to hear this is giving you problems still, can you post the content of the child theme index.php (to http://pastebin.com).
As a test please add some extra static code, for example immediately under this code:
add this code:
<h1>CHILD THEME TEST</h1>
This is temporary so ignore styling issues as this should be removed once working.
The other possibility that springs to mind is that the child theme CSS file (style.css) doesn’t reference the Parent Theme. This is an example of the header of style.css in the Child Theme directory, note in particular the last line called Template:
Theme Name: Newscast Child
Description: A sleek themeforest Blog and Magazine Theme child theme
Author URI: http://www.kriesi.at
The Child Theme name must be different from the Parent Theme name (as per my example) and the newscast text should refer to the folder name for the Parent Theme. If you’ve renamed the Parent Theme Newscast directory, please change it back to “newscast”.
Please also post the site URL, makes it easier to check whats going on.
Let me know how you get on.
JamesFebruary 22, 2011 at 1:47 pm #40731
thanks for your reply.
– here the index.php with <h1>CHILD THEME TEST</h1>
– this is the css in the child theme:
Theme Name: newscast child sf
Theme URI: http://www.sergiofores.com
Description: Child base
Author: Sergio Forés
Author URI: http://sergiofores.com
/* Estilo custom */
/* Estilo por defecto newscast */
The site is: http://www.ailladearousa.com/blog/
I can make some screenshots to see chidtheme structure folder.
s.March 7, 2011 at 9:48 am #40732March 7, 2011 at 11:05 am #40733
The topic ‘read index.php from within child theme folder to translate some texts.’ is closed to new replies.