I added breadcrumb navigation to WordPress & I'm facing one problem. Here's the function.php code of the breadcrumb:
function ux_breadcrumbs() {
if (!is_home()) {
echo '<a href="';
echo get_option('home');
echo '">';
bloginfo('name');
echo "</a> » ";
if (is_category() || is_single()) {
the_category('/');
echo " » ";
if (is_single()) {
echo " ";
the_title();
}
} elseif (is_page()) {
echo the_title();
}
}
}
The above code is displaying all categories of the post. I just want it to display only one category. Thanks in advance!
UPDATE: Thanks for the help...here's one more thing:
I want to know how to display category > sub category in the breadcrumb if exists.