Advertisement
Guest User

Untitled

a guest
Oct 21st, 2019
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.29 KB | None | 0 0
  1. <?php $parentscategory ="";
  2. foreach((get_the_category()) as $category) {
  3. if ($category->category_parent == 0) {
  4. $parentscategory .= ' <a href="' . get_category_link($category->cat_ID) . '" title="' . $category->name . '">' . $category->name . '</a>, ';
  5. }
  6. }
  7. echo substr($parentscategory,0,-2); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement