Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

183
Visualizações
Show this custom text in one specific category

How to alter this custom text, so it will only be shown in one specific category, let's say: ONLY in category: tables?

add_action( 'woocommerce_after_shop_loop_item', 'show_meer_varianten_loop', 100 );
function show_meer_varianten_loop() { ?>
    <div class="custom-label-variable">✓ Meer varianten</div>
    <?php
}

in css:

.products .product:not(.product-type-variable) .custom-label-variable {
    display: none;
}
about 4 years ago · Juan Pablo Isaza
3 Respostas
Responde à pergunta

0

You are using WooCommerce so check your body classes. There should be some class that references that category like category_tables or term-01.

You can manage your CSS like this:

body:not(.category_tables) .products .product:not(.product-type-variable) .custom-label-variable {
    display: none;
}

It's not the best option, but it's a quick and effective solution for those who don't know how to work with WP Functions.

about 4 years ago · Juan Pablo Isaza Relatório

0

Try this..I think it works ..

add_action( 
'woocommerce_after_shop_loop_item', 
'show_meer_varianten_loop', 100 );
function show_meer_varianten_loop() 
{ 
global $product;       
if ( has_term( 'tables', 
'product_cat', $product->ID ) ) { ?>
 <div class="custom-label- 
  variable">✓ Meer varianten</div>
  <?php
}
}
about 4 years ago · Juan Pablo Isaza Relatório

0

I got the answer from @helgatheviking:

The working one is:

add_action( 'woocommerce_after_shop_loop_item', 'show_meer_varianten_loop', 100 );
function show_meer_varianten_loop() {
global $product;
if ( $product && has_term( 'tables', 'product_cat', $product->get_id() ) ) { ?>
<div class="custom-label-variable">✓ Meer varianten</div>
<?php
}
}
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda