newboxters
Member
Posted 3 years ago #
the_category view correctly, but with link:
Parent Category > Children Category
get_category_parents view without links, but with > after the last element:
Parent Category > Children Category >
As to show the the_category but without the link or to show get_category_parents but without the eparator after the last element?
Thank you.
newboxters
Member
Posted 3 years ago #
I wonder if someone know which file I can edit this function (get_category_parents) and not show the separator after the last element?
newboxters
Member
Posted 3 years ago #
razorguy
Member
Posted 3 years ago #
<a href="<?php echo get_option('home'); ?>">Home</a> › <?php the_category(' › ', 'multiple' ); ?> › <?php the_title(); ?>
That should work....
razorguy
Member
Posted 3 years ago #
tried and works perfectly!
newboxters
Member
Posted 3 years ago #
razorguy, that works, but he also generates the link. I needed that it separated in that way, but without the link.
"As to show the the_category but without the link or to show get_category_parents but without the separator after the last element?"
<?php
foreach((get_the_category()) as $category) {
echo $category->cat_name . ' ';
}
?>
newboxters
Member
Posted 3 years ago #
gszhl
<?php
foreach((get_the_category()) as $category) {
echo $category->cat_name . ' ';
}
?>
But this will don't show any separator?
I just don't wanted show the last separator. Is it possible?
Thank you.
building from gszhl's and razorguy's posts:
<?php
$my_title_cats = '';
foreach (get_the_category() as $category)
$my_title_cats .= $category->cat_name . ' › ';
echo substr($my_title_cats, 0, -26);
?>
is one way that might work for you.
peace~