Looper Custom Post Type Sort by Custom Field

Hey All,

I have a custom post type (therapists) that I would like to be displayed in alphabetical order based on their last name. I have their first name and last name as separate custom fields within this post type and I would like to know how/if it would be possible for me to sort this post type by last, first order without doing something like changing the title of the post (which I would like to keep as First Last for SEO reasons).

Thanks!

Hey All,

I was able to get it to sort by my custom field, I just have one other question regarding how I can exclude a single post from this based on post id. This is my currently looper provider wp query:

post_type=therapists&orderby=meta_value&meta_key=last_name&order=asc&posts_per_page=0

Thanks!

Hey All,

Sorry again, I figured out the solution to my problem. In order to adjust the query to exlude you need to add:

&post__not_in[]=*id of post*

If you need to exclude several posts I found you can just copy this and add a new id and it will work.

thanks!

Hey @michigancreative,

We are just glad that you have figured out a way to resolve your issue. If there is anything else we can help you with, please do not hesitate to open another thread.

Cheers.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.