/ Published in: PHP
                    
                                        
                            
                                Expand |
                                Embed | Plain Text
                            
                        
                        Copy this code and paste it in your HTML
$mf_query = <<<EOF
    SELECT t.*, tt.*, p.*
    FROM {$wpdb->posts} as p, {$wpdb->term_relationships} as tr, {$wpdb->terms} AS t, {$wpdb->term_taxonomy} AS tt
    WHERE tt.`taxonomy` = 'bodies-of-work'
    AND t.`term_id` = tt.`term_id`
    AND tr.`object_id` = p.`ID`
    and tt.`term_taxonomy_id` = tr.`term_taxonomy_id`
    AND tt.`count` > 0
    GROUP BY t.`term_id`
    ORDER BY p.`post_date` DESCÂ
EOF;
$mf_terms = $wpdb->get_results( $mf_query );
    print "\n\t" . '<ul>';
    foreach ( $mf_terms as $mf_term ) {
        print "\n\t\t" . '<li><a href="' . get_term_link( $mf_term, $mf_term->taxonomy ) . '">' . $mf_term->name . '</a></li>';
    }
    print "\n\t" . '</ul>';
}Â
Comments
 Subscribe to comments
                    Subscribe to comments
                
                