Support » Fixing WordPress » WordPress Ordering posts in foreach statement

  • drhodes


    I have a for each statement that looks for a Taxonomy by ID and gets all termchildren and lists them using a foreach loop. I’m trying to figure out how to order them alphabetically by title. Here’s my code:

    $termID = 5;
    $taxonomyName = "apartmentlocation";
    $termchildren = get_term_children( $termID, $taxonomyName );
    foreach ($termchildren as $child) {
        $term = get_term_by( 'id', $child, $taxonomyName);
        echo '
    <li><a>name, $taxonomyName ) . '">' . $term->name . '</a></li>

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘WordPress Ordering posts in foreach statement’ is closed to new replies.