WP_Query -> sort results by relevance (= most tags / taxonomy terms in common)

I’m trying to write a new “related posts” widget (for the single post view) for my custom post type, filtering by custom taxonomy terms that the related posts should have in common with the current post. I found this solution. But what I’d like to add is that the posts are ordered by relevance. I … Read more

Sort posts alphabetically by custom field value, insert divider between different letters

i’m listing all posts of my custom post type “person” alphabetically sorted by the custom field last_name on a page. How would i insert a divider (e.g. an image of the letter) before a letter range starts? Here’s what i’m trying to do: Update: Here’s the code i’m using: <ul class=”list-ensemble”> <?php query_posts(‘post_type=person&post_status=publish&meta_key=last_name&orderby=meta_value&order=ASC’); if ( … Read more

Display sorting options dropdown when using WooCommerce product category shortcode

I have a WordPress site, with WooCommerce. The WooCommerce archives pages as shop display a dropdown sorting filter like in this screenshot: Now in another page let’s say example.com/foo On that page I use a WooCommerce shortcode: [product_category per_page=”90″ columns=”3″ orderby=”” order=”ASC” category=”foo” prdctfltr=”yes” pagination=”yes”] But the sorting dropdown is not shown. What I am … Read more

Sorting results from JSON-API on custom fields

Is there any way, out of the box, to sort results from the JSON-API plugin based on values in custom fields? The request is paged, so the results will need to be sorted server-side. I have an http request along the lines of: http://www.example.com/wordpress/?json=get_author_posts&author_slug=user&post_type=custom &include=title,custom_fields&custom_fields=date_value&count=10&page=1 I’d like to sort on the custom field date_value, ideally … Read more

How to sort posts by last name (2nd word) on ONE category only?

I have an “author” category that is used as a list to browse multiple posts containing author biographies. I have Smart Category Ordering installed and right now it is sorted by title ascending. Unfortunately there isn’t many options on this plugin and I haven’t found alternatives. Posts are titled “Firstname Lastname (country)” and I want … Read more