• Hello,

    I would like to know if it would be possible to put some code / text in one file in the aim to facilitate the translation of the blog’s functions by a child theme (the .mo file doesn’t allow me to do what I want)

    Here’s an example with my single.php

    <div class="post clearfix" id="post-<?php the_ID(); ?>">
    						<!-- google_ad_section_start(weight=hight) -->
    							<h1><a>" rel="<?php _e("bookmark"); ?>" title="<?php _e("Permanent Link to"); ?> <?php the_title(); ?>"><?php the_title(); ?></a></h1>
    						<!-- google_ad_section_end -->
    
                            <p class="postinfo"><?php the_author_posts_link(); ?> on <?php the_time('M d, Y') ?> with <a>"><?php _e('Comments'); ?> <?php comments_number('0','1','%'); ?></a></p>
    
    							<div class="entry clearfix">
    							    <!-- google_ad_section_start(weight=medium) -->
    								<?php the_content(''); ?>
    								<!-- google_ad_section_end -->
                                <?php wp_link_pages(); ?>
    							</div>

    Will become :

    <div class="post clearfix" id="post-<?php the_ID(); ?>">
    						<!-- google_ad_section_start(weight=hight) -->
    							<h1><a>" rel="<?php _e("bookmark"); ?>" title="<?php _e("Permanent Link to"); ?> <?php the_title(); ?>"><?php the_title(); ?></a></h1>
    						<!-- google_ad_section_end -->
    
                           $var_author_links
    
    							<div class="entry clearfix">
    							    <!-- google_ad_section_start(weight=medium) -->
    								<?php the_content(''); ?>
    								<!-- google_ad_section_end -->
                                <?php wp_link_pages(); ?>
    							</div>

    $var_autor_links will be defined in a file (lang.php, which will be referred in the theme’s header) where all the attributions will be defined like this :
    $var_single_author = <p class=”postinfo”><?php the_author_posts_link(); ?> on <?php the_time(‘M d, Y’) ?> with “><?php _e(‘Comments’); ?> <?php comments_number(‘0′,’1′,’%’); ?></p>

    To translate this theme (who is himself a child theme) in a another language I’ll have to create a child theme, translate the lang.php, put it in the child theme’s folder and the overwriting should do the rest.

    Here’s how it would look :

    myblogs.com (using a child theme, it’s in English)
    fr.myblogs.com (using a child theme of the child theme, it’s in French)

    Any ideas on how to do this ?

    Thanks you for your help.

    Best regards,

  • The topic ‘Putting code/text in variable’ is closed to new replies.