Sort X categories by last update and show image
Here’s one solution: global $wpdb; $cat_array = $wpdb->get_results( ” SELECT terms.*, posts.ID as post_ID FROM wp_terms terms JOIN wp_term_taxonomy term_taxonomy ON terms.term_id = term_taxonomy.term_id JOIN wp_term_relationships term_relationships ON ( term_relationships.term_taxonomy_id = term_taxonomy.term_taxonomy_id AND term_taxonomy.taxonomy = ‘category’ ) JOIN wp_posts posts ON ( posts.ID = term_relationships.object_id AND posts.post_type=”post” AND posts.post_status=”publish” ) GROUP BY terms.term_id ORDER BY … Read more