[Resolved] How to order posts by custom field?
Hi, I’ve created a CPT for staff members and I’d like them to sort on the page by last name, so that no matter what order they’ve been entered in, they show up alphabetically.
I have this code in the page template:
‘<?php query_posts( ‘post_type=staff’,’orderby=lname’, ‘order=ASC’); ?>’
lname is the name of the custom field – but it just sorts by latest post on top. Is there something else I need to add, or? Please advise.
- The topic ‘[Resolved] How to order posts by custom field?’ is closed to new replies.