sushma_proach

call product category all in one page

Jun 21st, 2016
38
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.61 KB | None | 0 0
  1. <?php
  2.   $taxonomy     = 'product_cat';
  3.   $orderby      = 'name';  
  4.   $show_count   = 0;      // 1 for yes, 0 for no
  5.   $pad_counts   = 0;      // 1 for yes, 0 for no
  6.   $hierarchical = 1;      // 1 for yes, 0 for no  
  7.   $title        = '';  
  8.   $empty        = 0;
  9.  
  10.   $args = array(
  11.          'taxonomy'=> $taxonomy ,'parent' => 0
  12.   );
  13.  $all_categories = get_categories( $args );
  14.  
  15.  foreach ($all_categories as $cat) {
  16.     if($cat->category_parent == 0) {
  17.         $category_id = $cat->term_id;      
  18.         echo '<br /><a href="'. get_term_link($cat->slug, 'product_cat') .'">'. $cat->name .'</a>';
  19.  
  20.  }} ?>
Add Comment
Please, Sign In to add comment