WordPress.org

Forums

Posts 2 Posts
Ordering of items in 'admin_dropdown' (3 posts)

  1. David Gard
    Member
    Posted 1 year ago #

    Hey,

    I've had a look on your site/GitHub and I cannot find a mention of this (please slap me if I've missed it), but I'm wondering if there is a hook to allow the ordering of items in admin_dropdown boxes?

    For example, I link member of staff to services, so the `Staff offering Service' dropdown should ideally be in alphabetical order, as it's hard to find who you are looking for in a list of 150-200.

    Thanks,
    David

    http://wordpress.org/plugins/posts-to-posts/

  2. landwire
    Member
    Posted 1 year ago #

    Hi there,
    I have no idea if this is any help. I used some code 2 years ago to order some items in P2P. I am just starting to use the plugin again, so have not tried the code yet:

    // P2P - to remove inherit types and sort alphabetically
    function order_pages_by_title( $args, $ctype ) {
    	//if ( 'posts_to_pages' == $ctype->name ) { //commented this out to filter all p2p connections by publish and private
    		$args['orderby'] = 'title';
    		$args['order'] = 'asc';
    		$args['post_status'] = 'publish, private';
    	//} //obviously this needs commenting ou too
    
    	return $args;
    }
    
    add_filter( 'p2p_connectable_args', 'order_pages_by_title', 10, 2 );
  3. tedinoz
    Member
    Posted 1 year ago #

    Have you looked at the documentation on "Connection ordering"?

    Ted

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic