Last active
October 3, 2018 18:26
-
-
Save steroyle/a6bffc5ccf7245955327a66b1b76b013 to your computer and use it in GitHub Desktop.
WooCommerce Categories Loop
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 | |
$categories = get_categories( | |
array( | |
'taxonomy' => 'product_cat', | |
'orderby' => 'name', | |
'hide_empty' => '0' | |
) | |
); | |
?> | |
<ul class="categories"> | |
<?php foreach($categories as $category): ?> | |
<li class="category"> | |
<p>ID: <?php echo $category->term_id; ?></p> | |
<p>Name: <?php echo $category->name; ?></p> | |
<p>Slug: <?php echo $category->slug; ?></p> | |
<p>Image URL: <?php echo wp_get_attachment_url(get_woocommerce_term_meta($category->term_id, 'thumbnail_id', true )); ?></p> | |
<p>Link: <?php echo get_category_link($category->term_id); ?></p> | |
</li> | |
<?php endforeach; ?> | |
<ul> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment