Last active
December 29, 2017 08:17
-
-
Save fbmoises/88f8d89665dddb9bfadc9e3c3d330493 to your computer and use it in GitHub Desktop.
Mostrar la imagen de la taxonomía en la página de archivo delante de la descripción
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
// Mostrar la imagen de la taxonomía en la página de archivo delante de la descripción | |
if ( in_array( 'woocommerce/woocommerce.php', get_option( 'active_plugins' ) ) ){ | |
add_action( 'woocommerce_archive_description', 'wcfb_taxonomy_archive_image', 2 ); | |
function wcfb_taxonomy_archive_image() { | |
if ( is_product_taxonomy() && 0 === absint( get_query_var( 'paged' ) ) ) { | |
$term = get_queried_object(); | |
$image = ''; | |
if( !empty($term->term_id) ){ | |
$thumbnail_id = get_woocommerce_term_meta( $term->term_id, 'thumbnail_id', true ); | |
$image = wp_get_attachment_url( $thumbnail_id ); | |
} | |
if($image && $image !=''){ | |
echo '<div class="grid_slider">'; | |
echo '<img src="' . esc_url( $image ) . '" alt="' . esc_attr( $term->name ) . '" title="' . esc_attr( $term->name ) . '" />'; | |
echo '</div>'; | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment