Advertisement
jegtheme

themes-functionality.php

Jul 31st, 2014
186
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.79 KB | None | 0 0
  1. function jeg_get_all_portfolio_category ($pageid) {
  2.     $category = array();
  3.  
  4.     $query = new WP_Query(array(
  5.         'post_type' => 'portfolio',
  6.         'meta_query' => array(
  7.             array(
  8.                 'key' => 'portfolio_parent',
  9.                 'value' => array($pageid),
  10.                 'compare' => 'IN',
  11.             )
  12.         ),
  13.         'orderby' => 'menu_order',
  14.         'order' => 'ASC',
  15.         'nopaging' => true
  16.     ));
  17.  
  18.     $result = $query->posts;
  19.     foreach($result as $key => $value) {
  20.         $termlist = get_the_terms($value->ID, JEG_PORTFOLIO_CATEGORY);
  21.         if( !empty($termlist) ) {
  22.             foreach($termlist as $termkey => $termvalue) {
  23.                 $category[$termkey] = $termvalue->name;
  24.             }
  25.         }
  26.     }
  27.  
  28.     return $category;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement