-
posts
inner join wp_term_relationships on wp_term_relationships.object_id = ID
inner join wp_term_taxonomy on wp_term_taxonomy.term_taxonomy_id = wp_term_relationships.term_taxonomy_id
inner join wp_terms on wp_terms.term_id = wp_term_taxonomy.term_id
where post_type = 'post'
and wp_term_taxonomy.taxonomy = 'category'
order by wp_term_taxonomy.term_id desc";
$post = $wpdb->get_results($tsql);
$lastParent = null;
foreach($post as $result)
{
if($lastParent != $result->term_id)
{
echo "
- ".substr($result->post_title, 0, 300)."".((strlen($result->post_title)>300)?"...":"")." "; $lastParent = $result->term_id; } ?>