Notice: These forums are now retired and closed. For active support, please Submit a Ticket or visit our official WordPress.org community pages.
Kadence Theme | Kadence Blocks | Starter Templates | WooCommerce Email Designer | Ascend | Virtue | Pinnacle

Virtue Child Theme – functions.php

Home / Forums / Virtue Theme / Virtue Child Theme – functions.php

This topic is: Resolved
[Resolved]
Posted in: Virtue Theme
August 17, 2017 at 11:29 am

Hello,

I’ve created a child theme here: bushvines.co.uk

I’d like to add some php to the functions.php file, which is currently blank.

When I add the code below to the functions.php of the Virtue theme itself, it works beautifully (but of course it doesn’t survive upgrades, which is why I created the child theme). I just don’t know how to set up a functions.php file from scratch that will do the same job, and I get all sorts of ugly things happening…

What I want to add is this:

add_filter(‘gettext’, ‘translate_text’);
add_filter(‘ngettext’, ‘translate_text’);

function translate_text($translated) {
$translated = str_ireplace(‘Related Products’, ‘You might also like…’, $translated);
$translated = str_ireplace(‘Product Description’, ‘Tasting Notes’, $translated);
$translated = str_ireplace(‘Thank you. Your order has been received.’, ‘Thank you. We have received your order and will be in touch shortly to arrange delivery/pickup.’, $translated);
return $translated;
}

function my_woocommerce_catalog_orderby( $orderby ) {
unset($orderby[“popularity”]);
return $orderby;
}
add_filter( “woocommerce_catalog_orderby”, “my_woocommerce_catalog_orderby”, 20 );

———————————

Thanks for any and all help! Valerie

  • The forum ‘Virtue Theme’ is closed to new topics and replies.