Support

Account

Home Forums General Issues Order by ACF Reply To: Order by ACF

  • 
    <?php 
    $args = array(
        'taxonomy'     => 'sock-club',
        'hide_empty'   => '0'
          );
    $terms = get_terms('sock-club', $args);
    if ($terms) {
        foreach ($terms as $index => $term) {
            $terms[$index]->star_rating = get_field('star_rating', $taxonomy.'_'$term_id);
          
        }
        usort($terms, 'my_sort_function');
        
        // create the list after the terms are sorted
        // need to loop through them again
        $term_list = '';
        foreach ($terms as $term) {
            $term_list .= '<a href="' . get_term_link( $term ) . '" title="' . sprintf( __( 'View all post filed under %s', 'my_localization_domain' ), $term->name ) . '">' . $term->name . '</a>';
        }
          
    }
    
    ?>