The Support Forums will be in read-only mode for a scheduled maintenance window on 01 September 2016 14:00 UTC - 20:00 UTC. More information.

WordPress Ordering posts in foreach statement (2 posts)

  1. drhodes
    Posted 4 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
    Posted 4 years ago #


Topic Closed

This topic has been closed to new replies.

About this Topic