Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #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.

    #40726

    Hey,

    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.

    James

    #40727

    Thanks James!

    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:

    <div class=”entry-bottom”>

    ” class=”more-link”><?php _e(‘Leer más’,’newscast’); ?>

    </div>

    If I understood well, child theme should search in current child theme folder before that in parent theme. But it does not.

    #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_Themes

    #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?

    #40730

    Hey,

    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:

    <div id="content">

    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
    Version: 1.0
    Author: Kriesi
    Author URI: http://www.kriesi.at

    Template: newscast
    */

    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.

    James

    #40731

    Hi James,

    thanks for your reply.

    - here the index.php with <h1>CHILD THEME TEST</h1>

    http://pastebin.com/Bt5TLvtr

    - 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

    Template: newscast

    Version: 0.1

    */

    /* Estilo custom */

    @import url(‘custom.css’);

    /* Estilo por defecto newscast */

    @import url(‘../newscast/style.css’);


    The site is: http://www.ailladearousa.com/blog/

    I can make some screenshots to see chidtheme structure folder.

    thanks,

    s.

    #40732

    Ok, now runs.

    #40733

    Glad that you solved the problem. I set the status to resolved.

Viewing 9 posts - 1 through 9 (of 9 total)

The topic ‘read index.php from within child theme folder to translate some texts.’ is closed to new replies.