Skip Navigation

[Resolved] Additional info in connect existing post select options

This support ticket is created 3 years, 3 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

This topic contains 1 reply, has 1 voice.

Last updated by markL 3 years, 3 months ago.

Author
Posts
#2169509

I have a post type that has many posts with the same title with many to many relationships. When I use the connect existing post dialog in the admin side, I want to be able to display some post meta in the select options to be able to differentiate between the posts with the same name.

Currently users need to just trial and error and then use the connected post listing to try to see the post id. This is not ideal.

I acknowledge that this probably doesn't fall within the scope of "support", but if you could please point me to where these options are generated I can try to figure something out for myself.

I have looked in select2.js but I don't think this is where the options are being generated.

Thanks

#2169523

Actually I sorted it by updating plugins\types\application\controllers\ajax\handler\related_content_action.php at around line 1000

		// byetc edit - get code
			$byetc_types = array( 'unit-of-competency', 'qualification', 'assessment-package');
			$byetc_type = get_post_type( $post->get_id() );
			if( in_array( $byetc_type, $byetc_types ) ){
				$code = get_post_meta($post->get_id(), 'code', true).' - ';
				$status = ' - '.get_post_meta($post->get_id(), 'status', true);
			} else {$code='';}
			

			$formatted_posts[] = array(
				'id' => $post->get_id(),
				'text' => $code . $post->get_title() . $status,
				'disabled' => $disabled,
			);
		}