Advertisement
jegtheme

themes-functionality.php

Jul 30th, 2014
221
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.73 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.         foreach($termlist as $termkey => $termvalue) {
  22.             $category[$termkey] = $termvalue->name;
  23.         }
  24.     }
  25.  
  26.     return $category;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement