Print this Post

How to change / translate a string in Graphene Theme

Let’s start with an example. Graphene Theme shows post author’s info after the post content. It has the title “About the author“. But you wanted it to be “About me” or something else. How do you change it?

You can change this by hacking the theme core or by editing the language file. But your edits will get vanished after the theme update. So, you have to do this everytime when the theme gets an update. That’s why it is not suggested to hack the parent theme. So, is there any other solution to change/translate strings without touching the parent theme? Yes, there is a solution. This is when you have to consider using a child theme.

Here is a custom function to change or translate a string in graphene theme without messing up with parent theme files. This function goes in your child theme’s functions.php file. So, if you are not yet using a child theme, get it now.

Here is the Author info box with “About the author” title.

"About the author" title in author info box

“About the author” title in author info box

Now, add this function to the child theme’s functions.php file.

function graphene_filter_gettext( $translated, $original, $domain ) {
	$strings = array(
		'About the author' => 'About me',
	if ( ! empty( $strings[$original] ) ) {
		$translations = &get_translations_for_domain( $domain );
		$translated = $translations->translate( $strings[$original] );
	return $translated;
add_filter( 'gettext', 'graphene_filter_gettext', 10, 3 );

Note: If your child theme’s functions.php file is empty, put the above code between openning and closing php tags.
custom function

Okay, let’s refresh the page.

"About me" title for author info box

“About me” title for author info box

Look! About the author title is now changed to About me. Here is the explanation,

WordPress uses gettext for localization. So, we are adding a filter to gettext using the above function. In the 3rd line, About the author is the original string and About me is the translated/changed string. So, we pass the arguement as ‘About the author’ => ‘About me’. So, when the file is loaded, it tells wordpress to change About the author to About me.

Since we are putting this in an array, you can translate more than one strig in a single function. Just separate the strings by a comma.

function graphene_filter_gettext( $translated, $original, $domain ) {
	$strings = array(
		'About the author' => 'About me',
		'Leave a Reply' => 'Write a Comment',
		'View full post' => 'Read more',
	if ( ! empty( $strings[$original] ) ) {
		$translations = &get_translations_for_domain( $domain );
		$translated = $translations->translate( $strings[$original] );
	return $translated;
add_filter( 'gettext', 'graphene_filter_gettext', 10, 3 );

So, Leave a Reply will be changed to Write a Comment and View full post becomes Read more. This way, you can change the default theme strings to whatever you want.

PS: If you are interested in translating the Graphene Theme into your language, please join the theme’s developers group

Short Link:

About the author

Prasanna SP

Student | WordPress Dev | Tech Blogger | Interested in GNU/Linux, FOSS, PHP, Drupal, WordPress, Ethical hacking, Photography, Painting, Literature etc..

Permanent link to this article: http://www.prasannasp.net/how-to-change-translate-a-string-in-graphene-theme/


Skip to comment form

  1. Berenice

    Hello! I have question about the Graphene footer, it doesn’t have to do with this topic, I’m sorry, but I thought perhaps you could help me.

    The website is http://www.mastersidiomas.com.ar/spanish/
    I’d like the text in the footer (The blue Copyright area) to be different in one specific page, is there a way to do it?

    I’d appreciate any help, thank you so much! Your website has been really useful to me, thank you for your work

  2. Olga

    I tried to change the German language on my web page http://ayurveda.nada-massag.com into Russian, but I do not know how to do it correctly. Can you give me advice?
    I wanted to put a russian social button on the page, but this resulted in damage page. How can I do it right?
    Thanks for you help!

  3. Sia

    Hi! If you’re interested in a good online alternative to translate WordPress themes, I warmly recommend https://poeditor.com/
    It even has a plugin which you can use to connect your site to the localization platform via API: https://wordpress.org/plugins/poeditor/

  4. gaurav

    hello sir, i am post my blog but cannot be show read more button. so how can i show my read more button in Graphene Theme.

  5. Max


    I’m using Graphene, it’s excelent but there-s one little problem with the translation of the description of categories.


    It shows this text in any language I choose. I’m using qTranslate-X and this is the only problem I found.

    Can you help me to fix it? Thanks a lot

Leave a Reply

Your email address will not be published. Required fields are marked *

Please put your code snippet between <code> and </code>. Comment moderation is in use. Please do not submit your comment twice -- it will appear shortly.

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.