• Resolved gbaka

    (@gbaka)


    I’m trying to add this code to my category for images

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

    but the code doesn’t change IDs on different category pages I’m stuck with 1 image on all categories.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Try:

    <?php
    $this_category = get_category($cat);
    echo '<img src="http://test.ani-down.net/images/wpaper/'. $this_category->cat_name .'.jpg" alt="'. $this_category->cat_ID .'" />';
    ?>
    Thread Starter gbaka

    (@gbaka)

    thank you so much it fixed the problem.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘category image problem’ is closed to new replies.