WordPress.org

Support

Support » Plugins and Hacks » Can't get desired sort order

Can't get desired sort order

  • Here’s code I’m using:

    $args = array(
    	'taxonomy'     => 'destinations',
    	'term_args'    => array(
    		'orderby'      => 'id',
    		'order'        => 'ASC',
    		'hierarchical' => 1,
    		'hide_empty'=> 0,
    	),
    );
    $terms = apply_filters( 'taxonomy-images-get-terms', '', $args );
    if ( ! empty( $terms ) ) {
    	print "\n" . '<ul>';
    	foreach( (array) $terms as $term ) {
    		print "\n" . '<li>';
    		print "\n\t" . '<a href="' . esc_url( get_term_link( $term, $term->taxonomy ) ) . '">' . wp_get_attachment_image( $term->image_id, 'small' ) . '</a>';
    		print "\n\t" . '<h2><a href="' . esc_url( get_term_link( $term, $term->taxonomy ) ) . '">' . esc_html( $term->name ) . '</a></h2>';
    		print "\n" . '</li>';
    	}
    	print "\n" . '</ul>';
    }

    as it relates to this page:
    http://www.daleygolfholidays.co.uk/destinations/

    I was expecting Hierarchical to be taking effect in ‘term args’ but it isn’t behaving as I expected, which is to list ‘Pas de calais’ after ‘France’ as ‘France’ is the parent, and to list ‘A new resort’ after ‘Spain’ as ‘Spain’ is the parent.

    How should code change to reflect child terms listing after their parents?

    http://wordpress.org/extend/plugins/taxonomy-images/

  • The topic ‘Can't get desired sort order’ is closed to new replies.