I am trying to:
I need to ordering view by profile type (works ok) and secondary sorting by post title (not working).
The first filter works ok but the second filter by post title alphabetical order is not working
Link to a page where the issue can be seen:
hidden link
I expected to see:
Instead, I got:
find a printscreen attached with my view backend configuration
It looks like it's working correctly except for the first item: Leopoldo E. Garcia Mansilla. Please try the following troubleshooting steps:
- Copy the code from this View's Loop editor and paste it here for me to review.
- Temporarily deactivate all plugins except Types and Views. Activate a default theme like Twenty Seventeen, then test again.
- If the problem is resolved, reactivate your theme and plugins one by one until the problem returns.
- If the problem was not resolved, please take a screenshot of the post editor screen in wp-admin so I can see Leopoldo's profile post.
Christian, thanks for your help!
it was an error from a profile label. Now the order of profiles is working as I expected.
Now my code list all the profiles and order by profile type and then by A-Z post title.
This is great but i need to solve one special case where the order of the profiles is by profile type but also instead of ordering for A-Z post title, take the order of profiles from a menu that lists the profiles manually.
Hope to find a solutions, thanks in advance.
This is great but i need to solve one special case where the order of the profiles is by profile type but also instead of ordering for A-Z post title, take the order of profiles from a menu that lists the profiles manually.
Views doesn't offer a sorting option based on the order of a specific WordPress menu, unfortunately. That would require complex custom code that falls outside the scope of support we provide here in the forums.
You can sort by menu order, but this is the order applied in the Post Attributes meta box of the post type editor (see the screenshots), not the order of a specific menu. If you want to use this option, edit the post type and turn on the "Page Attributes" section. Then you can apply a "menu order" value in the post editor screen and use "menu order" in the View's secondary sorting option.
Great Christian! thanks for your advice.
I follow the instructions and it works. Then i´ve found that this type of second sorting will be used for all the cases.
I need to apply this order to only 4 lawyers using page atribute for one specific view of a practice area.
I think that i need some extra code that detects url slug (eg: administrative-law)
and then run this special code to show the lawyers in a particular order at this practice area.
If not the usual second sorting A-Z will execute normally.
Hoping to find a solution, thanks in advance.
The easiest way to do that is to create two Views and use conditional HTML to display one or the other.
- Revert the change in this View, then create a duplicate of this View. You can create a duplicate by going to Toolset > Views and hover over the View name.
- In the duplicate View, reapply the changes we discussed above.
- Use conditional HTML to display one of the Views based on the page slug or any other criteria you want to use. For example:
[wpv-conditional if="(ARRAY('page-slug-1','page-slug-2','page-slug-3') eq '[wpv-post-slug]')"]
[wpv-view name="special-case-view-slug"]
[/wpv-conditional]<br />
[wpv-conditional if="(ARRAY('page-slug-1','page-slug-2','page-slug-3') eq '[wpv-post-slug]')" evaluate="false"]
[wpv-view name="original-view-slug"]
[/wpv-conditional]
Replace page-slug-1, page-slug-2, page-slug-3 with the actual slugs of the posts that should include the special case View. Replace the View shortcodes to display the correct Views.
https://toolset.com/documentation/user-guides/conditional-html-output-in-views/