Skip to content

Commit

Permalink
Ajuste de atribuição de taxonomia para produtos do Woocommerce nas br…
Browse files Browse the repository at this point in the history
…eadcrumbs
  • Loading branch information
allysonsouza committed Mar 31, 2016
1 parent dc186ff commit 2c4c918
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions core/helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -254,25 +254,27 @@ function odin_breadcrumbs( $homepage = '' ) {
}

// Gets post type taxonomies.
$taxonomy = get_object_taxonomies( 'product' );
$taxy = 'product_cat';

$taxonomies = get_object_taxonomies( 'product' );
$taxonomy = 'product_cat';
} else {
$post_type = get_post_type_object( $post->post_type );

echo '<li><a href="' . get_post_type_archive_link( $post_type->name ) . '">' . $post_type->label . '</a></li> ';

// Gets post type taxonomies.
$taxonomy = get_object_taxonomies( $post_type->name );
$taxonomies = get_object_taxonomies( $post_type->name );
}

if ( $taxonomy ) {
$taxy = $taxonomy[0];
if ( $taxonomies ) {
// If is woocommerce product post type, $taxonomy already defined
if ( 'product' !== $post->post_type ) {
$taxonomy = $taxonomies[0];
}
// Gets post terms.
$terms = get_the_terms( $post->ID, $taxy );
$terms = get_the_terms( $post->ID, $taxonomy );
$term = $terms ? array_shift( $terms ) : '';
// Gets parent post terms.
$parent_term = get_term( $term->parent, $taxy );
$parent_term = get_term( $term->parent, $taxonomy );

if ( $term ) {
if ( $term->parent ) {
Expand Down

0 comments on commit 2c4c918

Please sign in to comment.