Ready to get started?Download WordPress


WooCommerce - excelling eCommerce
Category List? (3 posts)

  1. Mithadriel
    Posted 1 year ago #

    This is probably really simple ... and I'm just being thick but I've been battling it for a couple of hours now so I'm hoping someone can assist :)

    I'm trying to generate a list of all Shop Categories ... I see that the taxonomy name is "product_cat" ... so this code should pull a list of them or am I 'doin it rong' ?

      'name' => 'product_cat'
    $output = 'objects'; // or objects
    if  ($taxonomies) {
      foreach ($taxonomies  as $taxonomy ) {
        echo '<p>' . $taxonomy->name . '</p>';


  2. Mithadriel
    Posted 1 year ago #

    Typically I found the answer moments later ...

    //list terms in a given taxonomy using wp_list_categories (also useful as a widget if using a PHP Code plugin)
    $taxonomy     = 'genre';
    $orderby      = 'name';
    $show_count   = 0;      // 1 for yes, 0 for no
    $pad_counts   = 0;      // 1 for yes, 0 for no
    $hierarchical = 1;      // 1 for yes, 0 for no
    $title        = '';
    $args = array(
      'taxonomy'     => $taxonomy,
      'orderby'      => $orderby,
      'show_count'   => $show_count,
      'pad_counts'   => $pad_counts,
      'hierarchical' => $hierarchical,
      'title_li'     => $title
    <?php wp_list_categories( $args ); ?>
  3. hellbertos
    Posted 1 year ago #

    Great post Mithadriel. I want to do the same thing with a site I am working on; though I am interested in adding the product category list with links to products w/in that category.

    My question to you is, which file are you modifying with the code above to get the list to print?

    Thanks for you post and in advance for any additional info you can share :-)

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic