[Resolved] Nested views, second sorting on custom field
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.
No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.
I wish to sort a view (legacy views) on two custom fields.
The secondary sorting does not allow custom fields and I thought I maybe could use two views that are nested?
1.0: View 1 sort by custom field A for post type A.
1.1: Take all post ids that is matching from 1.0 and send to View 2.
2.0: View 2 sort on custom field B for post type A with all matching ids from 1.1.
* Is this possible to collect all post ids and send in a batch to View 2?
* Is it possible to register/add a custom field for the standard secondary posting?
The UI doesn't let you set up secondary sorting via a custom field, but you could impose that via the API, namely by using the wpv_filer_query hook to modify the query arguments to suit your needs.
(Note that Types custom fields are stored in wp_postmeta with a 'wpcf-' prefix, so if you have a "priority" custom field, it would be stored in wp_postmeta with a key of 'wpcf-priority'.)
I will require bit more information about your structure.
1.0: View 1 sort by custom field A for post type A.
==>
Lets say this is your view 1.
1.1: Take all post ids that is matching from 1.0 and send to View 2.
==>
The View 2 is another view where you are getting the post IDs as a source to pass to the view 1 and those found post IDs posts will be displayed - correct?
2.0: View 2 sort on custom field B for post type A with all matching ids from 1.1.
==>
This is where I've bit confusion.
If you can setup a test install for me where I can review your structure and where you wanted to display what and what is your expected result.
If you want I can even setup a sandbox site for you where you can setup your structure with content and then I'll be able to guide you in the right direction.
*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.
I have set the next reply to private which means only you and I have access to it.
That is what I shared with my previous reply that I do not have capabilities to access your theme files and you added the filter code to your theme's funcitons.php file.
Can you please remove that code or grant me access so that I can access the theme files?
I have set the next reply to private which means only you and I have access to it.
You can now write to functions.php through the Theme File Editor at /wp-admin/theme-editor.php or use the plugin Code Snippets at /wp-admin/admin.php?page=snippets . The previous code in functions.php is removed by me in order to get a clean installation.
Due to security reasons it is not possible to connect over FTP/S or SFTP to the server.