Last active
March 17, 2021 12:15
-
-
Save Oscar-Abad-Folgueira/c6659f8ecd9c5a67da5fa545ef7dbb4a to your computer and use it in GitHub Desktop.
WooCommerce Snippet: Mostrar anuncio en la parte superior de un producto en concreto
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* @snippet WooCommerce Snippet: Mostrar anuncio en la parte superior de un producto en concreto | |
* @author Oscar Abad Folgueira | |
* @author_url https://www.oscarabadfolgueira.com | |
* @snippet_url https://www.oscarabadfolgueira.com/anadir-contenido-en-la-cabecera-de-los-productos-o-en-productos-en-concreto | |
*/ | |
add_action( 'wp_head', 'oaf_mostrar_anuncio' ); | |
function oaf_mostrar_anuncio() { | |
if ( is_product() && get_the_id() == 18 ) { | |
echo '<h2 class="anuncio-estrella">ESTE ES NUESTRO PRODUCTO ESTRELLA!!!</h2>'; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment