Support » Fixing WordPress » Change Category TItle in Link

  • Resolved Virendar

    (@virendar)


    I am using the code

    <?php the_category(‘ ‘); ?>

    to put a Link to the category of the currently viewing post.

    The link uses the category name as the text.

    I want to use my own text for the link.

    IE :

    Click HERE to go to the category page!

    The text “HERE” should link to the category page, in same manner as
    <?php the_category(‘ ‘); ?> code.

Viewing 1 replies (of 1 total)
  • I figured it out

    <?php
    $category = get_the_category();
    echo '<a href="'.get_category_link($category[0]->cat_ID).'">
    TEXT HERE
    </a>'; ?>
Viewing 1 replies (of 1 total)
  • The topic ‘Change Category TItle in Link’ is closed to new replies.