Site logo

Archived topic

Using elements for code

1 reply · Started by Ketil on July 26, 2021

Viewing posts 1–2 of 2

Hi. I have been adviced to put code in functions.php, and was wondering if I can use elements for this instead?
This is the code :
if( ! function_exists( 'yith_custom_custom_text_loop' ) ) {
add_filter( 'woocommerce_product_add_to_cart_text', 'yith_custom_custom_text_loop', 20, 1 );
function yith_custom_custom_text_loop ( $text ) {
global $product;
if ( $product->is_type( 'booking' ) && ! $product->is_purchasable() ) {
$text = __( 'Read more', 'your-theme-text-domain' );
}
return $text;
}
}

When adding code in elements, do I need to add open and closing php-tags?

This archived topic is closed to new replies.