Home Home Translation How to move translation to Child Theme?

You will need FTP access to the WordPress site either by using FTP Client or File Manager via cPanelHow to use FTP?

 

PART 1: EDIT CHILD THEME FUNCTIONS.PHP

STEP 1: FTP into your site. (Example via cPanel or FileZilla)

cPanel is recommended as you can edit the file without downloading it locally.

STEP 2: Go to wp-content/themes/listingpro-child/

Make sure first the Child Theme is installed and active.

STEP 3: Download and Edit functions.php

If you are using cPanel, simply right-click and Edit the functions.php file.

STEP 4: Copy the code below.

function listingpr_child_lang_setup() {
 load_theme_textdomain( 'listingpro', get_stylesheet_directory() . '/languages' );
 load_child_theme_textdomain( 'listingpro-child', get_stylesheet_directory() . '/languages' );
 }
 add_action( 'after_setup_theme', 'listingpr_child_lang_setup' );

STEP 5: Paste the code into the functions.php as shown below:

Code inserted via cPanel File Manager.
Make sure when you insert the above code from STEP 4, the closing tag ?> is at the end of the file as shown above (in red circle).

STEP 6: Save the functions.php changes to the server.

 


PART 2: MOVE LANGUAGES FOLDER TO CHILD THEME

You may use Loco translate or Poedit to create or edit translation files.

Move languages folder from  wp-content/themes/listingpro/

… To Child ListingPro theme wp-content/themes/listingpro-child/

Congradulations! after completing PART 1 and PART 2 you have successfully moved the translation to Child Theme. Now all the translation you will make in Loco Translate will take effect in the child theme and after the update you will not lose the translation.


STOP HERE! DON’T PROCEED TO PART 3 WITHOUT READING THIS CAREFULLY.

The following step is ONLY FOR USERS who have updated to the latest version of ListingPro after moving the translation to the child theme.

If you have to translate strings included in the latest release of ListingPro, you must repeat these steps in PART 3 after every update.

PART 3: REPLACE OLD .POT FILE AFTER UPDATE 

In case you are unable to find the text strings to translate after updating to the latest version it’s because you still have the old .pot file which is missing the new text strings.

STEP 1: Copy the .pot file from ListingPro Parent theme (Language Folder), /wp-content/themes/listingpro/languages

STEP 2: Paste the .pot file to ListingPro Child theme (Language Folder), /wp-content/themes/listingpro-child/languages.

STEP 3: Go to WP Admin > Loco Translate > Themes > ListingPro Child

STEP 4: Select the language translation file.

STEP 5: Click Sync

STEP 6: Click Save

Now you can translate or safetly update listingpro theme. For more info see How to update ListingPro WordPress theme?

Leave a Reply

Hello! Come Join ListingPro Official Community! JOIN NOW
+