Skip Navigation

[Resolved] Is there a way to sort CPT names in relationship form connection dropdown?

This thread is resolved. Here is a description of the problem and solution.

Problem:
How to sort posts displayed with the fields on post relationship form

Solution:
ou can add the orderby argument to your relationship form's [cred-relationship-role] shortcode which accepts the values date, title or ID.

For example:

[cred-relationship-role role='parent' orderby='title']

Relevant Documentation:
=> https://toolset.com/documentation/user-guides/front-end-forms/cred-shortcodes/#cred-relationship-role

This support ticket is created 4 years, 5 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.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

This topic contains 2 replies, has 2 voices.

Last updated by Michelle Dodd 4 years, 5 months ago.

Assisted by: Minesh.

Author
Posts
#1647487

Tell us what you are trying to do?

The dropdown to connect many-to-many CPT relationships shows the CPTs in random order.

1. Is there a way to sort/alphabetize this list?
2. Is there a way to use custom placeholder text rather than "Search for a post"
3. Is there a way to show more than 10 in the suggested dropdown?

Is there a similar example that we can see?

hidden link
site password: collaborate
Try "Add EHR" to see the Relationship form

#1647495

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

1. Is there a way to sort/alphabetize this list?
==>
Yes, You can add the orderby argument to your relationship form's [cred-relationship-role] shortcode which accepts the values date, title or ID.

For example:

[cred-relationship-role role='parent' orderby='title']

orderby. Optional. Can take the values of date, title or ID. ID is the default value. It will decide the order of the posts being offered in this role selector.

order. Optional. Can take values of ASC and DESC. DESC is the default value. Defines the direction for the post oreder being offered in this role selector.

More info:
=> https://toolset.com/documentation/user-guides/front-end-forms/cred-shortcodes/#cred-relationship-role

As per our support policy we entertain only one question per ticket. This will help other users searching on the forum as well as help us to write correct problem resolution summery for the original question.

I will split the ticket for the following question and will followup there respectively.
2. Is there a way to use custom placeholder text rather than "Search for a post":
3. Is there a way to show more than 10 in the suggested dropdown?

#1647887

My issue is resolved now. Thank you!