I resolved it by creating a new function based on the_category which works perfectly in a single.
This is the only way I could extract the category link in a single
Hi ceslava,
I have the same problem.
Please can you post that function here ?
Thanks
Sure, zeroo,
function get_categoria_post($separator = '', $parents='') {
global $wp_rewrite;
$categories = get_the_category();
if (empty($categories))
return apply_filters('the_category', __('Uncategorized'), $separator, $parents);
$rel = ( is_object($wp_rewrite) && $wp_rewrite->using_permalinks() ) ? 'rel="category tag"' : 'rel="category"';
$thelist = '';
if ( '' == $separator ) {
$thelist .= '';
foreach ( $categories as $category ) {
$thelist .= "";
switch ( strtolower($parents) ) {
case 'multiple':
if ($category->parent)
$thelist .= get_category_parents($category->parent, TRUE);
$thelist .= get_category_link($category->term_id);
break;
case 'single':
$thelist .= get_category_link($category->term_id);
if ($category->parent)
$thelist .= get_category_parents($category->parent, FALSE);
$thelist .= $category->name.'</a></li>';
break;
case '':
default:
$thelist .= get_category_link($category->term_id);
}
}
$thelist .= '';
} else {
$i = 0;
foreach ( $categories as $category ) {
if ( 0 < $i )
$thelist .= $separator . ' ';
switch ( strtolower($parents) ) {
case 'multiple':
if ( $category->parent )
$thelist .= get_category_parents($category->parent, TRUE);
$thelist .= get_category_link($category->term_id);
break;
case 'single':
$thelist .= get_category_link($category->term_id);
if ( $category->parent )
$thelist .= get_category_parents($category->parent, FALSE);
$thelist .= "$category->cat_name</a>";
break;
case '':
default:
$thelist .=get_category_link($category->term_id);
}
++$i;
}
}
return apply_filters('the_category', $thelist, $separator, $parents);
}
Check it out in justtellmewhy.com
<a href="<?php echo get_option('home'); ?>">Home</a> › <?php the_category(' › ', 'multiple' ); ?> › <?php the_title(); ?>