Advertisement
salmancreation

I want to know how to display category > sub category in the

Dec 22nd, 2015
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.85 KB | None | 0 0
  1. function ux_breadcrumbs() {
  2.     if (!is_home()) {
  3.         echo '<a href="';
  4.         echo get_option('home');
  5.         echo '">';
  6.         bloginfo('name');
  7.         echo "</a> » ";
  8.         if (is_category() || is_single() )
  9.         {
  10.             if( is_category() )
  11.             {
  12.                 single_term_title();
  13.             }
  14.             elseif (is_single() )
  15.             {
  16.                 echo " » ";
  17.                 $cats = get_the_category( get_the_ID() );
  18.                 $cat = array_shift($cats);
  19.                 echo '<a href="' . esc_url( get_category_link( $cat->term_id ) ) . '" title="' . esc_attr( sprintf( __( "View all posts in %s" ), $cat->name ) ) . '">'. $cat->name .'</a>';
  20.                 echo "  ";
  21.                 the_title();
  22.             }
  23.         } elseif (is_page()) {
  24.             echo the_title();
  25.         }
  26.     }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement