I’m working on a e-commerce website and I would like to know if it’s possible to have the same category for posts and woocommerce products ? I would like to get both articles and products from specific category. I’ve tried this https://wordpress.org/support/topic/relating-a-post-to-a-product-category which make products categories appears in posts but I don’t know how to display them in posts loop.
<article <?php post_class(); ?>>
<header>
<h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
<?php the_tags('<ul class="entry-tags"><li>','</li><li>','</li></ul>');
the_category( ' ' ); ?>
</header>
<div>
<?php the_excerpt(); ?>
<?php if ( has_post_thumbnail() ) {
the_post_thumbnail();
}
?>
</div>
</article>
Thanks in advance.
Checkout https://wordpress.org/support/topic/relating-a-post-to-a-product-category
The main idea is to modify the taxonomy to allow categories used for products and posts, or better create new taxonomy to prevent polluting the original taxonomy.