• I thought this would be easy, but it’s proving tricky for some reason.

    In a single post, I want to include a link like: “more in category blah”

    Of course, this is simple if I use the_category which gives me “more in social” but what I really want is to include “more in” in the actual link (i.e, more in social). Is there a way to do this?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter yolise

    (@yolise)

    Not possible?

    Thread Starter yolise

    (@yolise)

    I never did find a solution for this. Can anyone help?

    for instance:

    <?php $cats = get_the_category();
    foreach( $cats as $cat ) { ?>
     <a href="<?php echo get_category_link($cat->term_id); ?>">more in <?php echo $cat->name; ?></a>
    <?php } ?>

    if you have more than one category in your post, but only want show one link, try this:

    <?php $cats = get_the_category();
    foreach( $cats as $cat ) { ?>
     <a href="<?php echo get_category_link($cat->term_id); ?>">more in <?php echo $cat->name; ?></a>
    <?php break;
    } ?>
    Thread Starter yolise

    (@yolise)

    That’s perfect. Thank you!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘category link for single category to include preceeding text’ is closed to new replies.