Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function ov_mostrar_atributo_etiqueta_producto()
- {
- global $product;
- $etiqueta_term = $product->get_attribute('etiqueta');
- if ($etiqueta_term) {
- $etiqueta_terms = explode(',', $etiqueta_term);
- $etiqueta_classes = '';
- foreach ($etiqueta_terms as $term) {
- $term = trim($term);
- $term = remove_accents($term);
- $term = preg_replace('/[^a-zA-Z0-9\s]/', '', $term);
- $term = str_replace('%', '', $term);
- if (is_numeric(substr($term, 0, 1))) {
- $term_class = 'desc-' . strtolower(str_replace(' ', '-', $term));
- } else {
- $term_class = strtolower(str_replace(' ', '-', $term));
- }
- $etiqueta_classes .= ' ' . $term_class;
- }
- echo '<div class="ov-tag-producto' . $etiqueta_classes . '">' . $etiqueta_term . '</div>';
- }
- }
- add_action('woocommerce_before_shop_loop_item_title', 'ov_mostrar_atributo_etiqueta_producto', 10);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement