Skip Navigation

[Resolved] Sort by View

This support ticket is created 2 years, 11 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 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

This topic contains 37 replies, has 3 voices.

Last updated by igorL-3 2 years, 10 months ago.

Assisted by: Shane.

Author
Posts
#2145879

I modified the last bit of code after reading your reply again to
if ( !empty($art) ) {
array_merge($arts, $art->ID);
}

}
$query_args['post__in'] = $arts;
$query_args['orderby'] = 'post__in';

but the output doesn't follow the order in $arts

#2145923

I've fixed some stupid errors and checked the $query_arg manualy. It is as it should be.
However, the VIEW takes its ordering from the selection at the VIEW panel. The default is Post Title.
Is there a way to overwrite it?

#2146063

$query_args['orderby'] = 'post__in';
This should override the orderby settings applied in the View editor. Assuming the order is correct in the $arts array, I would expect this to work correctly.
- Can you confirm there is no secondary sorting applied in the View editor?
- Can I see the complete wpv_filter_query code?
- Check the View shortcode for the Arts View, to be sure orderby is not applied as a shortcode attribute.
- If there are any Query Filters in the Arts View, please toggle those open and take a screenshot so I can see the filter settings. Include that screenshot in your next reply.
- If you have any other custom code snippets, disable them temporarily while testing to ensure there is no interference.
- Temporarily activate a default theme or your parent theme to be sure there is no code in your custom theme interfering in sort order here.
- Temporarily disable any other 3rd-party plugins while testing to be sure they are not interfering with sort order here.

#2146611

Hello,

I have done all you suggested. All the snipers and plugins, except the relevant ones, are all the are deactivated. I have made a new view with no filters what so ever and made sure there is no secondary spring or anything in the short code. I changed to the original unmodified theme. Alas the sorting is being taken from the primary sorting order in the VIEW.

So I’ve uploaded this new version onto the same place. Please send me a secure request and I’ll send you your password and the URL’s of the relevant pages.

#2146901

Private fields are enabled here for your next reply. Please share the login information and relevant page URLs for me to investigate further.

#2146965

Hi,
I am not getting an option to send via private field!!

#2146967

I"ll try again - maybe there was a misconfiguration in my last reply. Please let me know.

#2152417

Hello Christian,

I haven't had any feedback from you in a week. Did my private message go through or is the problem so grave it requires the entire rewrite 😉 ?

#2152827

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Igor,

I must apologize for the delay here as Christian is currently on vacation and the ticket volume has been quite high.

However i'm currently having a look at this one for you.

Thanks,
Shane

#2152853

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Igor,

To ensure that I understand fully right now. You are using the custom code to sort the view alphabetically but this currently isn't working ?
hidden link

Please let me know.

#2152873

Yes correct! The order is stored in array $query_args['post__in'] ; which is in correct order. The parameter to use the ordering stored in $query_args['post__in'] is set by $query_args['orderby'] = 'post__in'; which is also correct but the ordering isn't working as I explaied in the private message to Christian of August 19th

#2152875

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Igor,

I suspect that the ordering was being interrupted by the post ordering on the view.

If you check now you should see your listing being ordered alphabetically.

Please let me know if this is ok now.
Thanks,
Shane

#2152889

No it hasn't! It's what it was doing all along. The first 3 posts ID's, for example, in the the $query_args['post__in'] are: ["post__in"]=> array(137) { [0]=> int(246723) [1]=> int(246582) [2]=> int(246639) ...
while the first 3 posts actually being displayed in the view are: 246774, 246770, 246772...
What you say is correct in that the post ordering on the view pannel is overriding the ordering in the $query_args['post__in'] . This is the very problem I have been dealing with. You just set the ordering by Post Title. I don't want that I want it ordered as per $query_args['post__in'] which is aphabetically by the artist surname. and according to the Christian advise as well as WP_Query documentation setting $query_args['orderby'] = 'post__in should do that but it doesn't!

#2152985

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Igor,

Can you let me know where you've added the code?

It would appear we need to do some debugging on the code to see why its not sorting according to what you've specified.

Thanks,
Shane

#2153017

Yes the location is given in the private message I sent to Christian above.

This ticket is now closed. If you're a Toolset client and need related help, please open a new support ticket.