Skip Navigation

[Résolu] I want to add 2 sortable column in custom post type overview

This support ticket is created Il y a 2 années et 3 mois. 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.

Aucun de nos assistants n'est disponible aujourd'hui sur le forum Jeu d'outils. Veuillez créer un ticket, et nous nous le traiterons dès notre prochaine connexion. Merci de votre compréhension.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9: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/Karachi (GMT+05:00)

Ce sujet contient 4 réponses, a 2 voix.

Dernière mise à jour par marcB-6 Il y a 2 années et 2 mois.

Assisté par: Waqar.

Auteur
Publications
#2448565

Hello Support Team,

I have one custom post type Jobs in that i have 2 post reference field "Related Location" and "Related Contact person" Field and i want to add both field value in post overview with column sortable.

Can you please help me with this.

Thanks

#2449177

Hi,

Thank you for contacting us and I'd be happy to assist.

To suggest the best way to achieve this, I'll need to see how this "Jobs" post type template and the post reference fields are set up.

Can you please share temporary admin login details, in reply to this message?

Note: Your next reply will be private and making a complete backup copy is recommended before sharing the access details.

regards,
Waqar

#2450813

Thank you for sharing the access details.

I understand you're referring to adding sortable columns in the post-management screen in the admin area and not the front end.

Toolset plugins don't include any built-in feature for this customization, so this will require either some third-party admin screen management plugin.

I see you've already added some custom code in the theme's "functions.php" file to add these columns, but, to make them sortable, you'll need to update your custom code as per this guide:
https://code.tutsplus.com/articles/quick-tip-make-your-custom-column-sortable--wp-25095

Note: Since post reference fields store the related post in the structure of post-relationship and not as custom fields, you may have to replace those post reference fields, with the regular select type fields, and then use the "wpt_field_options" filter, to programmatically generate those field options from the relevant post types:
https://toolset.com/documentation/programmer-reference/types-api-filters/#wpt_field_options

You'll find an example usage code in this support thread:
https://toolset.com/forums/topic/programmatically-add-options-to-select-custom-field-with-a-filter/#post-2320285

#2455097

My issue resolved

#2455099

My issue is resolved now. Thank you!