Post Types Order
[resolved] Reorder not reflected in taxonomy (3 posts)

  1. jimmywags
    Posted 3 years ago #

    I've used this plugin on several clients' sites with good results. (We have a developer's license.) But on a current testing site, there seems to be something wrong in the execution or a bug somewhere.

    We have a custom post type named 'People' with a custom taxonomy called 'Groups'. There are about 20 People posts and 2 Groups. Using the plugin, the People posts are ordered within their Group taxonomy. There is 1 People post that falls within both Groups. All the others are in a single Group.

    On the WP admin pages, the reorder works fine. Changes are saved correctly. On the front-end, one Group is shown in the correct re-order. The other group is not.

    The two groups are displayed by calling the same shortcode (and only via the shortcode), so I do not believe the error is there. But I cannot figure out why the one Group is shown correctly and the other is not.

    The Auto-Sort is set to ON/Custom. The code for the shortcode is below.

    $args = array( 'post_type' => 'people', 'posts_per_page' => -1, 'order' => 'ASC' );
    if( $group )
    	$args['tax_query'] = array( array( 'taxonomy' => 'group',
    							 'field' => 'slug',
    							'terms' => $group ) );
    $people = get_posts( $args );
    $ul = '';
    $ul .= '<ul class="people-list">';
    $ul .= "\n";
    foreach( $people as $this_person )
    	$ul .= '<li id="'. $this_person->post_name /* slug */ .'">';
    	$ul .= '<h2>'. get_the_title( $this_person->ID ) .'</h2>';
    	if( get_field( 'title', $this_person->ID ) != '' )
    		$ul .= '<p class="title">'. get_field( 'title', $this_person->ID ) .'</p>';
    	$ul .= '<div class="bio-wrap">'. str_replace( ']]>', ']]>', apply_filters( 'the_content', $this_person->post_content ) ) .'</div>';
    	$ul .= '</li>';
    	$ul .= "\n";
    $ul .= '</ul>';
    $ul .= "\n";
    return $ul;


  2. nsp-code
    Plugin Author

    Posted 3 years ago #

    Hi jimmywags
    Please always contact us through http://www.nsp-code.com/contact-us/ for a fast reply, as this board is checked from time to time.
    Try to add
    'suppress_filters' => false,
    'orderby' => 'menu_order'
    within your $args array

    Or try to use a custom query as is show in this API examples http://www.nsp-code.com/advanced-post-types-order-api/sample-usage/


  3. jimmywags
    Posted 3 years ago #

    Adding 'orderby' to the array made it work. I think didn't have that on purpose before, but I cannot remember why. Oh well, it's working now.

    Thanks for the quick reply!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic