WordPress.org

Ready to get started?Download WordPress

Forums

get_the_category_list (6 posts)

  1. kbkisan
    Member
    Posted 3 years ago #

    Hi, I'm building a wordpress site using the Autofocus template and I'm having problems with the meta part. The thing is that one the single.php pages I want to show all the categories used by the post and the tags and I'm doing it like this.

    <?php printf( __( '%6$s%7$s', 'sandbox' ),
    '<span class="author vcard"><a class="url fn n" href="' . get_author_link( false, $authordata->ID, $authordata->user_nicename ) . '" title="' . sprintf( __( 'View all posts by %s', 'sandbox' ), $authordata->display_name ) . '">' . get_the_author() . '</a></span>',
    get_the_time('Y-m-d'),
    get_the_time('H:i:sO'),
    the_date( '', '', '', false ),
    get_the_time(),
    get_the_category_list(', '),
    get_the_tag_list('<br/><div class="singletags">','<br/> ','</div>'),
    get_permalink(),
    the_title_attribute('echo=0'),
    comments_rss() ) ?>

    But when I go to a single page for some reason it only shows the last category in the list, i.e. if I would have linked the post with the categories

    news
    headline
    other

    in that order, it only prints out the category other.

    Any help would be greatly appreciated since this is messing up my vacation.

  2. kbkisan
    Member
    Posted 3 years ago #

    I made it simple so it is easier to look at the code, but the problem remains the same.

    <?php printf(__('%1$s%2$s', 'sandbox'), get_the_category_list(', '),get_the_tag_list('<br/><div class="singletags">','<br/> ','</div>') ) ?>

    Thanks in advance

  3. kbkisan
    Member
    Posted 3 years ago #

    ok I found this on the codex page

    When you assign multiple categories to a post, only one can show up in the permalink. This will be the lowest numbered category (see Manage Categories). The post will still be accessible through all the categories as normal.

    Is there anyone who knows of a plugin to override this function ?

  4. kbkisan
    Member
    Posted 3 years ago #

    Anyone ?

  5. chinmoy
    Member
    Posted 3 years ago #

    use the_category(', ') instead of get_the_category_list(', ')

  6. davaobase
    Member
    Posted 3 years ago #

    Nope, the_category doesn't work either. I have this exact same problem as kbkisan on my blog. See my support ticket here: http://wordpress.org/support/topic/the_category-doesnt-list-all-of-the-categories?replies=3

Topic Closed

This topic has been closed to new replies.

About this Topic