WordPress.org

Ready to get started?Download WordPress

Forums

List posts by child categories- with a category icon (2 posts)

  1. sarahhellems
    Member
    Posted 6 years ago #

    Hey guys,
    I'm trying to list all the posts within their categories, but have the category icon off to the left. I'm using the category icon plugin (found here). i want to be able to use their code to call the image, but I just don't know php well enough to figure it out. Can someone help?

    Here's the page I'm referring to. You can see that it's just showing 1 icon, and it's not the correct icon.

    Here's the code I'm using:

    <?php
    global $wpdb;
    $categories = $wpdb->get_results("SELECT $wpdb->terms.term_id AS id, name, description from $wpdb->terms INNER JOIN $wpdb->term_taxonomy ON $wpdb->terms.term_id = $wpdb->term_taxonomy.term_id WHERE parent = '3' ORDER BY name DESC");
    foreach($categories as $category) :
    
    ?>
    <div id="spacer"></div>
    
    <h2><div id="caticon">
    <?php get_cat_icon(); ?>
    </div>
    <a href="<?php echo get_category_link($category->id);?>"><?php echo $category->name; ?></a></h2>
    	<ul class="podlist">
    	<li><b><?php echo $category->description; ?></b>
    <br /><br />Sermons in this series:<br />
    <?php global $post;
    $myposts = get_posts('numberposts=999&'."category=$category->id");
    foreach($myposts as $post) : setup_postdata($post);
    ?>
    
    - <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a><br />
    <?php endforeach; ?>
    	</li>
    	</ul> 
    
    <?php endforeach; ?><br />
  2. submarine
    Member
    Posted 6 years ago #

    Hi Sarah,

    This topic should be closed. The solution :
    get_cat_icon('cat='.$category->id);

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.