2015-09-01 38 views

回答

1

以下是json格式中所有類別列表的功能。我希望這將是work.Please試試這個: -

<?php 
     function get_all_categories(){ 
      $args = array(
      'type'      => 'post', 
      'child_of'     => 0, 
      'parent'     => '', 
      'orderby'     => 'name', 
      'order'     => 'ASC', 
      'hide_empty'    => 1, 
      'hierarchical'    => 1, 
      'exclude'     => '', 
      'include'     => '', 
      'number'     => '', 
      'taxonomy'     => 'category', 
      'pad_counts'    => false 

     ); 


      $categories = get_categories($args); 
      return json_encode($categories)); 
     } 
    ?> 
+0

感謝分享 –

+0

@AliRaza歡迎:) –

相關問題