Translate Featured Products in Mystile

If you are experimenting with popular WordPress extension Woocommerce, there’s a good chance you’re using the free theme “Mystile”. It’s responsive, fairly customizable and it’s free – what’s there not to like about it?

Well, there’s one the one thing. No matter your language, when you enable the “Featured Products” and “Product Categories” options in your theme, Mystile will add those untranslatable headers to your front page. When your shop isn’t in English that’s rather inconvenient, right?

To solve this problem, you’ll need to make a change to the template files. Since those header names are hard coded they can’t be translated by (insert translation plugin of your choice) and you’ll also not find them in language files.

The solution (Quick and dirty)

  1. Open includes/theme-woocommerce.php in the theme editor (or the desktop app of your choice)
  2. Look for “Featured products”. You’ll find it on line 321 as in the code below
  3. Change “Featured Products” to something more suitable.
  4. Save your change(s) (and upload the files, if you’re not using the built-in editor)

[code language=”php”]<br />    if (class_exists(‘woocommerce’) &amp;&amp; $woo_options[ ‘woo_homepage_product_categories’ ] == "true" ) {<br />        echo ‘&lt;h1&gt;’.__(‘Product Categories’, ‘woothemes’).’&lt;/h1&gt;’;<br />        echo do_shortcode(‘[product_categories ‘. $params .’]’);<br />        woocommerce_reset_loop(); // can be removed post WooCommerce 1.6.4<br />    } // End query to see if products should be displayed[/code]

That solves your problem, right there. But the clean way to do this requires another step.

Child theme

If you want to do this the proper way, you have to do some extra work:

  • Create a child theme of Mystile
  • Copy /includes/themes-woocommerce.php to child theme
  • Make the changes to this copy
  • Save changes

Not sure how to create a child theme? There are some interesting plug-ins that can help you with that. But that’s content for another post.

Discover more from PowerUser Guide

Subscribe now to keep reading and get access to the full archive.

Continue reading