Questions tagged [order]

A parameter used in queries to specify the type and direction of sorting.

241 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
5
votes
1answer
257 views

wordpress query - orderby child post date

I have support ticket system which i have built using wordpress. The basic functionality is that when a "ticket" is created, it creates a post. When an admin replies, it then add a child post to the ...
4
votes
0answers
701 views

Order posts by meta_value even if meta_key is not filled

I want to sort search results by the value of custom field ('name-official') for all posts (is this field filled or not). But when I add filter in function.php like function searchExcludePages($query)...
4
votes
1answer
1k views

Sorting posts by custom date fields (non standard date format)

I've inherited a website with a post type courses that has a custom field 'date-start', a Date Picker. Unfortunately the date start is stored as 'ddmmyy' and the ACF documentation implies that this ...
4
votes
1answer
324 views

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. ...
4
votes
5answers
3k views

WooCommerce 'all' orders no longer being displayed - how may I debug/fix

I've just noticed that we seem to have a bug with our store. The 'all' orders selection is showing as empty but the other sub catergories such as completed, on hold and pending etc are there. I'm ...
3
votes
0answers
928 views

Show all parents and children in custom post type in right order

I would like to show all posts from a custom post type on one page with the ordering exactly like in the backend. I get the right ordering with wp_list_pages, but of course without the content. ...
3
votes
1answer
535 views

Revolution Slider Orderby Two Custom Fields

I have create Revolution Slider which load the custom post type, Events. There are two custom fields, Event Start Date and Event End Date. I would like to display order by Start and End date. Because ...
3
votes
2answers
2k views

How do I order pages and categories by ID or name in the same query?

I would like to query most of my pages and categories on the homepage. So far I am able to get the pages and category (posts), but I cannot order the list the way I want to. I want to be able to get a ...
2
votes
0answers
2k views

Woocommerce change tax rate programmaticly

We sell a combination of multiple products as one product, these products can't be added separte to WordPress so we use a normal product type for the combination. These products have seperate tax ...
2
votes
2answers
53 views

Ordering terms before displaying posts

My question is close to other questions, but I dont' have enough reputation to comment. I'm working for a restaurant and I 'd like, for my menu page, to organise my posts "meal" under terms "...
2
votes
0answers
229 views

WP_Query with tax_query, order by most 'matches'

TL;DR: How can I sort a WP_Query based on how many 'matches' there are on the tax_query set. Furthermore, how can I then add more posts if the posts_per_page is not met due to the tax_query added? ...
2
votes
1answer
681 views

Wordpress WP_Query orderby being overwritten

$args = array( 'post_type' => 'mcm_company', 'orderby' => 'title', 'order' => 'ASC', 'posts_per_page' => '1000', 'post_status' => 'publish', )...
2
votes
1answer
143 views

How to order posts by alphabet with numbers at the end

How to order posts by alphabet with numbers at the end. $params = array( 'limit' => -1, 'order' => 'ASC', ); I have a list of businesses (Pods framework post type) and they are in ...
2
votes
1answer
1k views

Order post by year DESC and month ASC

I have a worpresss 4.0.12 website; i created a custom template category-$id.php in which I have to show post ordering them by Year DESC and by month ASC (or a custom field ASC), the result should be ...
2
votes
0answers
726 views

sort by date in Advanced Custom Field

I am trying to filter posts with certain values and sort by the date field using ACF module. I have succeeded in filter with package and type. But when i added date sort, its not working. Please help ...
2
votes
0answers
1k views

WP_Query Order by Specific Post ID First

I'm creating a website where I have a need to show a set of posts from a custom loop but I need to display a specific post first. This post will be dynamically specified in the URI by a $_GET ...
2
votes
2answers
2k views

Display custom post types by date field

I have a custom post type that is simply titles with a date field. I want to display these posts in a list in order of this date field (not date posted). So simply: -- Sample date Event title 1 ...
2
votes
2answers
276 views

How to query different post types in specific order?

I have 3 posts types, articles, news and tips. On the home page I want to query 20 posts in this order: article, article, news, news, tip, ...// same order again until 20 If I use a custom query ...
1
vote
0answers
39 views

WP_Query: Group events by year, sorted DESC; then by date for each year group, sorted ASC

I'm trying to set up a query for an "event" custom post type that groups posts by year, with a heading for each year, in descending order; then, for each year group, ordered by date in ascending order ...
1
vote
1answer
75 views

Meta query with order by another custom field

Edit: I will try to explain in detail my problem. I am working on a portfolio site. There are a few custom post types: Projects, Publications, Exhibitions, Lectures and Slides. Home page consists of ...
1
vote
0answers
24 views

Weird orderby => post__in issue

I seem to have run into a sort of odd issue with WP_Query post__in I can't quite figure out. ANY help is appreciated! Goal/Progress so far: Overall I want to merge two arrays and use the merged ...
1
vote
1answer
19 views

Order RSS content by an advanced custom field value

I have created a custom post-type called "event". For this custom post-type I created an advanced custom field called "event_date". Now I am trying to display the list of my events in a RSS feed. ...
1
vote
0answers
17 views

How to do WP_Query with two meta fields with orderby clause

The goal is to first try to order by the custom meta field and if its not found then do order by the post date. Here is the query I did so far, but its not working. $args = array( 'post_type' =&...
1
vote
0answers
49 views

Taxonomy list : how to order by count percentage of custom post type

I have a taxonomy list. and taxonomy have two custom post types. I want to order taxonomy according to this result. Lets say : A = count of my A custom post type B = count my B custom post type (...
1
vote
1answer
442 views

Change default ordering of taxonomy terms - pre_get_terms

I wanted to change the default taxonomy terms order by its 'term_order' value instead of 'name' in admin side. So I tried something like below. But it doesn't work and php memory exhaust. function ...
1
vote
1answer
64 views

Remove the first 5 characters of the_title and orderby that

I have a custom post type where all titles are dates (in this format: YYYY-MM-DD). I need to order them by month then day, but not at all by year. So I imagine I need a filter to 'look' 5 characters ...
1
vote
1answer
291 views

Order by summing multiple values

In a custom post type (products) I want to order products by summing multiple values based on user selection. I use custom taxonomies to filter the products. I could use the orderby meta_value but ...
1
vote
0answers
20 views

Sort WP posts by span value

on website I have multiple posts that contains specific span. Example: *Post 1: 4 Post 2: 3 Post 3: 7** Is it possible to order posts by this span values?
1
vote
0answers
32 views

Understanding the orderby in WP_Query?

For quite a while I have been trying to query posts, with 2 different meta_queries, and order them differently. I followed the WP codex. Recently I have found out that I have been mistaken this ...
1
vote
0answers
180 views

get_adjacent_post() returning weird results

I am using get_adjacent_post() function to display links to a previous and next post. It is a custom post which also has a custom taxonomy. This is the code I am using: $prev = get_adjacent_post(...
1
vote
0answers
584 views

WooCommerce order complete email logic

Can someone helps me to understand the logic of WooCommerce for sending email on a completed order? If I'm not wrong, the mail is send when the order is marked complete, but I'm not able to find the ...
1
vote
1answer
878 views

I Changed the Menu Order, But the Page Order Didn't Change on Front Page

First-timer here! I'm trying to change the order of pages on my boardgame webpage, as displayed on the top banner www.mangakagame.com . Basically, I've used "Edit" in the Dashboard and adjusted all ...
1
vote
0answers
189 views

Sort order by slug for looped child terms of custom taxonomy

I have page that displays multiple carousels that contains the posts for each child term of parent taxonomy: projects for the custom taxonomy: portfolio-categories for CPT: portfolios. When Portfolio ...
1
vote
1answer
217 views

Order by empty custom field

I order my posts by custom field faq-order. That's work for me: $faqArgs = array( 'post_type' => 'faq', 'meta_key' => 'faq-order', 'order' => 'ASC', 'orderby' => '...
1
vote
0answers
53 views

Order categories by name or view count

I have a piece of code in witch i cant figure out how to order my subcategories by names or by view count. I have tried a lot of thing but my coding skills ate not good enough. This code displays ...
1
vote
1answer
148 views

Get_Users Orderby Page

I've been trying to fix a sorting issue using the codex for get_users(), but I can't seem to get it working. The codex shows that I can set 'orderby' => 'post_count', but I want to change this so ...
1
vote
1answer
354 views

How to order and group custom post type posts by year and month

I am building an event calendar and trying to create a filter bu month & year. I have custom post type named "event-calendar" and need to have 5 events per row as i have them in a slider. So need ...
1
vote
1answer
1k views

Order Posts by meta value AND published date

I want to order WP posts by meta key named "sort_date" and if it doesn't exist it should use the post's published date to order posts. Below is the code i am currently using function ...
1
vote
0answers
436 views

Order Custom Post Type by Custom Field Value

I'm having trouble getting my custom ordering to work. I'm trying to order a custom post type by a custom field called feature_order which is a numeric field (created with Advanced Custom Fields ...
1
vote
0answers
104 views

WooCommerce orderby template disappears and not longer works on search page

i have Problem and no solution :/ when i search in a product_cat and the URL looks like http://example.com/wprest/shop/?product_cat=clothing&s=ninja the orderby is no longer showing and: ?...
1
vote
0answers
78 views

Add to query for the_content() on single page

I have a page template that, firstly, has a loop towards the top in order to display a list of links to testimonial custom posts (I'm using a plugin to re-order posts): <?php query_posts('...
1
vote
1answer
369 views

How to sort posts inside categories

A weird question from my friend - is it possible in WordPress to sort posts inside categories? Right now the sort order is the default. He shows on specific pages posts from different categories. That'...
1
vote
4answers
4k views

How to order posts by title after they have already been sorted by category

I'm not an expert at much, so please excuse me if this is an easy question... but it's got my head spinning. I have an archive template (adapted from a standard 'enfold' theme template) which I am ...
1
vote
0answers
472 views

Set Order Status to Complete After Payment - from another site

We need to do a external call for updating the order status. Is there a webhook so we can do a order status update from another site? Here is the code when updating internally (on the same site): ...
1
vote
0answers
522 views

WooCommerce - How to show specific category first-rest of products-specific category last

This is the case: A product has 2 categories: "New products" and "Shirts" Another product has 2 categories: "Shirts" and "Outlet" What I need is to show in a paginated loop the products with the ...
1
vote
1answer
293 views

Help ordering Post loop by two meta values

Background: I have a custom post type "events" which has a post meta value of a unix timestamp called event start date. I also have a post meta value of ticket_status that has 3 possible values (S=...
1
vote
0answers
147 views

Order ascending is ignored in meta query?

I'm using pre_get_posts to alter my main query and attach a meta query to it. This is on a woocommerce products archive page (...not sure if that would make a difference). function has_upcoming_date(...
1
vote
0answers
31 views

Alter main archive, to show posts with meta as last

I'm having troubles with getting posts with meta_value "sold" as last in the main query of my custom Post type. The best/easiest way i can think of at the moment is to filter the "sold" posts out of ...
1
vote
0answers
29 views

comments sorting incorrectly across multiple pages

This is a related_comments.php file which should display comments on certain pages in ascending order while the newest comment should be at the top. This is working fine if there is only one page for ...
1
vote
0answers
39 views

Order char by post title

This is my code: $args = array( 'post_type' => 'post', 'orderby' => 'post_title', 'order' => 'DESC', 'posts_per_page' => 15, 'tax_query' => array( array( ...

1
2 3 4 5