Skip Navigation

[Resolved] Sort view by intermediary post type’s content

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

Problem:

Sort a post view by intermediary post type's custom field.

Solution:

You need to:
1) register my custom field into its intermediary post type;

2) to setup the view so that it queries the posts of that intermediary post type, and order by custom field

Relevant Documentation:

This support ticket is created 6 years, 4 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
- 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/Hong_Kong (GMT+08:00)

This topic contains 10 replies, has 2 voices.

Last updated by ELAN42 6 years, 3 months ago.

Assisted by: Luo Yang.

Author
Posts
#1128268

Hello,
I am facing the same problem of this fellow user right here:
https://toolset.com/forums/topic/sorting-custom-view-query-by-intermediary-post-types-content-order-number/

I read the whole discussion and have already tried to 1) register my custom field into its intermediary post type; 2) to setup the view so that it queries the posts of that intermediary post type, and order by custom field, but it doesn't seem to be working.

Please, can you help me?

#1128827

Hello,

Same as above, please check the compatibility problem first:

1) deactivate other plugins and switch to wordpress default theme, and test again

2) If the problem still persists, please provide a database dump file (ZIP file) of your website in below private detail box, also point out the problem view URL, I need to test and debug it in my localhost, thanks

#1132601

We deactivated everything,
and it still not works.

Do you want a website dump ?

#1133165

I have enabled the enabled the private detail box, please provide your database dump file(zip file or downloadable URL), also point out the problem view URL I need to test and debug it in my localhost

#1134031

Your database dump file is not valid, I get a lots of mysql errors when import it, you can follow our document to make the backup file:
https://toolset.com/faq/provide-supporters-copy-site/
or you can provide your website credentials, I can check it directly in your website.

#1134147

Hello,
I have updated the previous reply with another dump (IOCUM_studiogiochi_com.sql.zip).

I have checked (with an import into an empty database) that it's a valid one.

#1134171
import-error.JPG

Unfortunately, there are still mysql errors when I import your database dump file, see screenshot import-error.JPG.

I suggest you provide your website credentials in above private message box,
https://toolset.com/forums/topic/sort-view-by-intermediary-post-types-content/#post-1133470

#1134195

We are using a Linux machine (for the export we tried both the MySQL command line and PHPMyAdmin), so I suppose it's some kind of encoding issue.

Anyway, I have updated the private message above with the credentials to the website.

#1134802

Thanks for the details, I can login your website, since you did not point out the view URL and page URL, I have setup another view in your website:
1) post view: Sort view by intermediary post type
hidden link

It is duplicated from your post view "ordine autori (in scheda pubblicazioni)"

The only difference is in section "Elemento del ciclo in Sort view by intermediary post type", I have changed the codes from:

[wpv-post-title item="@autore.parent"]

To:

[wpv-post-link item="@autorepubblicazioni.parent"]

The many-to-many relationship slug is "autorepubblicazioni", see it here:
hidden link

Put it in content template "single-pubblicazioni":
hidden link
{!{wpv-view name='sort-view-by-intermediary-post-type'}!}

See the result here:
hidden link
it works fine, see screenshot sort-by.JPG

#1135972

Thanks a lot: that's what we were looking for.

Though: is there any way to hide the numbers (1, 2, 3 etc) and just keep the associated values (the names)?

#1135979

Solved by our own! Thank you again.