Guest User

Untitled

a guest
Mar 1st, 2016
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. function get_parent_category(){
  2. $categories = get_the_category( $this->post->ID );
  3. //var_dump($categories);
  4. $parentscategory = '';
  5. foreach ($categories as $category){
  6. if ($category->category_parent == 0){
  7. $parentscategory .= ' <a href="' . get_category_link($category->cat_ID) . '" title="' . $category->name . '">' . $category->name . '</a>, ';
  8. }
  9. }
  10.  
  11. return $parentscategory;
  12. }
Advertisement
Add Comment
Please, Sign In to add comment