- This topic has 3 replies, 2 voices, and was last updated 8 years, 9 months ago by Mahesh.
-
AuthorPosts
-
January 21, 2016 at 2:20 pm #83383deevdParticipant
help me, please
Whwre i can thanslate this text into another language?January 21, 2016 at 3:26 pm #83388MaheshParticipantHi deevd,
The theme is made translation ready by default, you can use translation plugins such as WPML, Qtranslate etc for the translations.
Regards,
MaheshJanuary 21, 2016 at 3:37 pm #83393deevdParticipant>> The theme is made translation ready by default, you can use translation plugins such as WPML, Qtranslate etc for the translations.
no no… I would like to edit the source code in file. I do not like translation plugins.
January 21, 2016 at 3:55 pm #83399MaheshParticipantHi @deevd,
Well in that case, you have to first create a child theme. You can find more details on creating child theme HERE.
Then you have to override some function with child theme’sfunctions.php
.
Following are the functions to be overridden.
1. For changing Posted on and by textfunction adventurous_header_meta() { $date = sprintf( '<a href="%1$s" title="%2$s" rel="bookmark"><time class="entry-date" datetime="%3$s">%4$s</time></a>', esc_url( get_permalink() ), esc_attr( get_the_time() ), esc_attr( get_the_date( 'c' ) ), esc_html( get_the_date() ) ); $author = sprintf( '<span class="author vcard"><a class="url fn n" href="%1$s" title="%2$s" rel="author">%3$s</a></span>', esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ), esc_attr( sprintf( __( 'View all posts by %s', 'adventurous' ), get_the_author() ) ), get_the_author() ); // Translators: 1 is category, 2 is tag, 3 is the date and 4 is the author's name. $utility_text = __( '<span class="on-date">Posted on %1$s</span><span class="by-author"> by %2$s</span>', 'adventurous' ); printf( $utility_text, $date, $author ); }
2. For changing Posted in and tagged text
function adventurous_footer_meta() { // Translators: used between list items, there is a space after the comma. $categories_list = get_the_category_list( __( ', ', 'adventurous' ) ); // Translators: used between list items, there is a space after the comma. $tag_list = get_the_tag_list( '', __( ', ', 'adventurous' ) ); // Translators: 1 is category, 2 is tag, 3 is the date and 4 is the author's name. if ( $tag_list ) { $utility_text = __( '<span class="in-category">Posted in %1$s</span><span class="sep"> | </span><span class="in-tag">Tagged %2$s</span>', 'adventurous' ); } elseif ( $categories_list ) { $utility_text = __( '<span class="in-category">Posted in %1$s</span>', 'adventurous' ); } printf( $utility_text, $categories_list, $tag_list ); }
3. For changing Older posts and Newer posts text
function adventurous_content_nav( $nav_id ) { global $wp_query, $post; /** * Check Jetpack Infinite Scroll * if it's active then disable pagination */ if ( class_exists( 'Jetpack', false ) ) { $jetpack_active_modules = get_option('jetpack_active_modules'); if ( $jetpack_active_modules && in_array( 'infinite-scroll', $jetpack_active_modules ) ) { return false; } } // Don't print empty markup on single pages if there's nowhere to navigate. if ( is_single() ) { $previous = ( is_attachment() ) ? get_post( $post->post_parent ) : get_adjacent_post( false, '', true ); $next = get_adjacent_post( false, '', false ); if ( ! $next && ! $previous ) return; } // Don't print empty markup in archives if there's only one page. if ( $wp_query->max_num_pages < 2 && ( is_home() || is_archive() || is_search() ) ) return; $nav_class = 'site-navigation paging-navigation'; if ( is_single() ) $nav_class = 'site-navigation post-navigation'; ?> <nav role="navigation" id="<?php echo $nav_id; ?>" class="<?php echo $nav_class; ?>"> <h1 class="assistive-text"><?php _e( 'Post navigation', 'adventurous' ); ?></h1> <?php if ( is_single() ) : // navigation links for single posts ?> <?php previous_post_link( '<div class="nav-previous">%link</div>', '<span class="meta-nav">' . _x( '←', 'Previous post link', 'adventurous' ) . '</span> %title' ); ?> <?php next_post_link( '<div class="nav-next">%link</div>', '%title <span class="meta-nav">' . _x( '→', 'Next post link', 'adventurous' ) . '</span>' ); ?> <?php elseif ( $wp_query->max_num_pages > 1 && ( is_home() || is_archive() || is_search() ) ) : // navigation links for home, archive, and search pages ?> <?php if ( function_exists('wp_pagenavi' ) ) { wp_pagenavi(); } else { ?> <?php if ( get_next_posts_link() ) : ?> <div class="nav-previous"><?php next_posts_link( __( '<span class="meta-nav">←</span> Older posts', 'adventurous' ) ); ?></div> <?php endif; ?> <?php if ( get_previous_posts_link() ) : ?> <div class="nav-next"><?php previous_posts_link( __( 'Newer posts <span class="meta-nav">→</span>', 'adventurous' ) ); ?></div> <?php endif; } ?> <?php endif; ?> </nav><!-- #<?php echo $nav_id; ?> --> <?php }
Regards,
Mahesh -
AuthorPosts
- The topic ‘Theme translation’ is closed to new replies.