Forums

[resolved] adding link get_the_category (3 posts)

  1. Otenyano
    Member
    Posted 2 years ago #

    <?php
    foreach((get_the_category()) as $category) {
    echo '<img src="http://example.com/images/' . $category->cat_ID . '.jpg" alt="' . $category->cat_name . '" />';
    }
    ?>

    Anyone got an idea on how to link this on there category?

    thanks

  2. MichaelH
    Volunteer
    Posted 2 years ago #

    Not sure what you are asking so will throw this out there:

    echo '<p> category ' . '<a href="' . get_category_link( $category->cat_ID, 'post_tag' ) . '" title="' . sprintf( __( "View all posts in %s" ), $category->name ) . '" ' . '>' . $category->cat_name.'</a> has ' . $category->count . ' post(s). </p> ';
  3. Otenyano
    Member
    Posted 2 years ago #

    get_category_link();

    sheyt... thanks man.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.