Support » Fixing WordPress » Custom category link text?

  • Resolved StamperTV


    This one is completely escaping me – how would you guys go about creating a link to a category within the loop, that ISN’T the generated category title? I’ve searched the world and figure I’m either wording my issue wrong or the answer is something simple, right under my nose.

    <?php the_category(); ?>

    Something along these lines doesn’t seem to work:
    <a href="<?php the_category(); ?>">Blah</a>

    Goal: View All > = Link to category.

    Should I not be using the_category? Is my syntax off? Someone save me a bullet here. I figure 3 or 4 days of trial and error is enough on my end.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Moderator keesiemeijer



    this shows all categories as Blah linking to the categories (use in loop):

    $categories = get_the_category();
    if(!empty($categories)) :
    <p>View All
    <?php foreach($categories as $category) : ?>
     <a href="<?php echo get_category_link($category->cat_ID ); ?>" title="<?php echo $category->cat_name;  ?>">Blah</a>
    <?php endforeach; ?>
    <?php endif; ?>

    Thank you.

    Please mark thread as resolved so that

    – others with similar problem can see it as resolved and will read this thread for help if they have similar problem

    – people providing help see it as resolved and will not waste time reading this post.

    Looked for it, took a minute to figure out how. Sorry.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Custom category link text?’ is closed to new replies.