[plugin: category icon lite] Shows same image (2 posts)

  1. molmadem
    Posted 4 years ago #


    I'm trying to use Category Icon Lite to display categories in a 3 column 2 row format. I have it almost working, but it shows the same image for all the categories, even though I have set different images for each category.

    I've searched through the plugin authors website, and can't find how to do it, and as the last post there was back in April and hasn't been replied to, I'm not sure that the author is supporting it anymore. My PHP isn't great, so I wonder if anyone can take a look at my code and suggest where I'm going wrong.

    <?php $count = 0;?>
    <?php $categories = get_categories('title_li='); ?>
    <?php foreach ($categories as $cat) { ?>
    <div class="onethirdcolumn">
    <?php // Get the ID of a given category
    $category_id = get_cat_ID( 'Category Name' );
    // Get the URL of this category
    $category_link = get_category_link( $category_id );
    <!-- Print a link to this category -->
    <h2><a href="<?php echo $category_link; ?>?category_name=<?php echo $cat->category_nicename ?>"><?php echo $cat->cat_name; echo get_cat_icon_lite($category_id); ?></a></h2><p><?php echo $cat->category_description?></p>
    if($count == 2 ) {
    echo "<div style='clear:both;'></div>";}
    $count = $count+1;
    } ?>

    The url in the link is correct for each category, but the images aren't. It would appear that the code get_cat_icon_lite($category_id); isn't being incremented.

    Thanks in advance.

  2. submarine
    Posted 3 years ago #


    you must change this line :
    $category_id = get_cat_ID( 'Category Name' );
    by this one:
    $category_id = $cat->term_id;

Topic Closed

This topic has been closed to new replies.

About this Topic