Reputation: 1046
I'm trying to change "Tag" to "Brand" on WooCommerce. I've Googled, read about gettext, tried several other options but none have worked.
The line of code in the theme is
<?php echo $product->get_tags( ', ', '<span class="tagged_as">' . _n( 'Tag:', 'Tags:', $tag_count, 'woocommerce' ) . ' ', '.</span>' ); ?>
What's the most proper (upgrade-proof) way to change that word "Tag"? I know I shouldn't edit the theme directly.
Should I edit the .mo and .po files? I edited the .po but it didn't take on the change (I'm supposed to generate a .mo afterwards somehow?)
Other links said to add a filter to my wp theme's functions.php.
WooCommerce themselves recommend a plugin http://docs.woothemes.com/document/woocommerce-localization/, but my server runs out of memory and can't complete the rescan process.
I'm confused at the number of options and workarounds that are needed to change a string. Did I miss any other options?
Upvotes: 0
Views: 1148
Reputation: 26075
The .po/.mo
option is feasible if your site is in another language, and yes you need to generate the .mo
file which is the one that WP reads.
A simpler way would be creating a child theme and substituting this file through it.
Another option is to use this plugin, adjusting the context to frontend
and the post type to product
. But beware that's an expensive plugin as it goes through all translatable strings of a page (and more).
Finally, you could use jQuery or JS to do it. Using the hook wp_footer
and some Conditional Tag to target your specific page(s).
Upvotes: 1