Support » Everything else WordPress » To list categories in the <title> (separator)

  • 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.

Viewing 8 replies - 1 through 8 (of 8 total)
  • I wonder if someone know which file I can edit this function (get_category_parents) and not show the separator after the last element?

    No is possible??

    <a href="<?php echo get_option('home'); ?>">Home</a>&nbsp;&rsaquo;&nbsp;&nbsp;<?php the_category('&nbsp;&rsaquo;&nbsp;&nbsp;', 'multiple' ); ?>&nbsp;&rsaquo;&nbsp;&nbsp;<?php the_title(); ?>

    That should work….

    tried and works perfectly!

    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 . ‘ ‘;
    }
    ?>

    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.

    ty

    (@junsuijin)

    building from gszhl’s and razorguy’s posts:

    <?php
    $my_title_cats = '';
    foreach (get_the_category() as $category)
       $my_title_cats .= $category->cat_name . '&nbsp;&rsaquo;&nbsp;&nbsp;';
    echo substr($my_title_cats, 0, -26);
    ?>

    is one way that might work for you.
    peace~

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘To list categories in the <title> (separator)’ is closed to new replies.