WordPress.org

Ready to get started?Download WordPress

Forums

WordPress Ordering posts in foreach statement (2 posts)

  1. drhodes
    Member
    Posted 2 years ago #

    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>
    ';
        }
  2. drhodes
    Member
    Posted 2 years ago #

    Anybody?

Topic Closed

This topic has been closed to new replies.

About this Topic