Skip to content

Instantly share code, notes, and snippets.

@fbmoises
Last active December 29, 2017 08:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fbmoises/88f8d89665dddb9bfadc9e3c3d330493 to your computer and use it in GitHub Desktop.
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
// 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