WordPress.org

Ready to get started?Download WordPress

Forums

Taxonomy Images
Can't get desired sort order (1 post)

  1. Twentyfourten
    Member
    Posted 1 year ago #

    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/

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.