WordPress.org

Ready to get started?Download WordPress

Forums

Subcategories as thumbnails in an archive ? (1 post)

  1. Dunkkan
    Member
    Posted 4 years ago #

    Hello guys,

    In one of my categories, I'd like to display thumbnails of its subcats, driving to a second archive template, with titles, excerpts, and links to the single view.

    How would you do to have some subcategories being listen as thumbnails ?

    I found this code in this thread :

    <?php
    $childCatID = $wpdb->get_col("SELECT term_id FROM $wpdb->term_taxonomy WHERE parent=$deptID");
    	if ($childCatID){
    	foreach ($childCatID as $kid)
    	{
    	$childCatName = $wpdb->get_row("SELECT name, term_id FROM $wpdb->terms WHERE term_id=$kid");
    	echo $childCatName->term_id;
    	echo $childCatName->name;
    	}
    
    	?>

    But I don't know how to use it. Where should I put it ? How could I pull an image of the last post under that subcat ?

    Thanks, any help is much appreciated.

Topic Closed

This topic has been closed to new replies.

About this Topic