Questions tagged [order]

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

Filter by
Sorted by
Tagged with
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 ...
0
votes
3answers
643 views

WP_Query not resetting after wp_reset_postdata

I have this custom query: if (isset($_COOKIE['myCookie']) && $_COOKIE['myCookie'] == $f_r) { $args = array( 'posts_per_page' => 4, 'nopaging' => false, 'order' => ...
0
votes
0answers
58 views

Order 2 meta_queries differently in WP_Query?

I have a custom WP_Query with 2 different meta queries. I want to order the results of both queries differently. The first meta_query I want to order by a custom field (high integer - low integer). ...
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 ...
1
vote
1answer
124 views

Show listings from Impress Listing plugin in random order using taxonomy and terms

I am not able to get the listings to show up. I have verified the slug for the post type and the taxonomy. This code I know works because I have used it for other post types and taxonomy's. Any ...
0
votes
1answer
430 views

Wp Query sort order from custom MetaBox

I am trying to sort a list of post based of the meta_key deal amount, which would be to display the highest deal first and work its way down to smaller deal amounts. The deal amount would be anywhere ...
0
votes
1answer
31 views

Order management including recurring orders on woocommerce

I've been trying to find a good way for handling order management as I have some recurring payments on my business. I need to set up a system that informs me how many items I should have in stock ...
0
votes
0answers
41 views

Sorting with meta_query and multiple, optional meta keys

I'm trying to sort a custom post type by 3 properties: Meta Key: is_featured Meta Key: is_primary Title The two keys are boolean ACF items, and are both optional, so most of the posts don't have the ...
0
votes
1answer
274 views

WooCommerce Order Action In New Page

I have added an action button to the orders page and I want it to open in a new window. This is my code: if ( $order->has_status( array( 'processing' ) ) ) { // Get Order ID (...
0
votes
2answers
183 views

Orderby Title not working

When I'm trying to sort my blog posts or my woocommerce in alphabetical order nothing changes. If I access the /?orderby=title-asc or ?orderby=title-desc it brings me the same results. Any sugestions?...
0
votes
0answers
45 views

Why does this incorrect pre_get_posts meta_query work for sort order?

I've got a fairly complicated post type archive page that I need to order by two meta fields and the post title. To do that, I'm using pre_get_posts with a meta_query that simply tests for the ...
0
votes
0answers
79 views

WP Query. Ordering posts by another post types meta

I have a custom post type called BID which contains a users bid (similar to freelancer.com, upwork, etc) However I need the BID results on the page to be ordered by meta stored in a users profile, ...
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 "...
0
votes
1answer
1k views

Stylesheet Enqueue Order and Best Practices

i would like to do the following: customize a theme to my likings for use on several sites and installations. so i can make "global" changes (via own plugin?) then i would like to have a site ...
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(...
0
votes
1answer
51 views

Sort loop by title doesn't sort single digits like human would

Post titles have numbers from 1 to 50 and i want to sort them in order, it's not possible to use 2 digits, the sequence goes like: 1,2,3,4,5...50. So i use: $query->set('orderby', array( 'title' =...
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
2answers
122 views

Display posts from #6 to #20 on archive page

My client shows his 5 most recent posts (excerpts) on the homepage followed by a "read more" link. On archive page he does not want to display the 5 most recent post again but posts from #6 to #20. ...
2
votes
1answer
1k views

Display custom post types with custom date field value (before today) & order by custom date field

I'm trying to display custom post types with custom date field value being before today. It works OK for showing posts before today, but the order is only based on post date. I want to have the result ...
0
votes
1answer
557 views

Add button linked to single product page on order detail page

I have write a code on functions.php so when customers click a button on order detail page, redirected to product page and review tab of the product they bought. But as a novice coder, I can't get the ...
1
vote
2answers
244 views

(Solved) WP_Query ($ args) -> How to sort letters and numbers within the same array

I'm developing a system where I have a Deck presentation. I have a field that takes the post by the 'copas' type of card being within the 'meta_value' array specification, and I would like it to be ...
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 ...
0
votes
1answer
489 views

how can i add an additional action into woocommerce admin order page through my plugin?

Currently I am building a plugin which I need to add an action button in order to print a pdf with admin order.
2
votes
2answers
296 views

can't get query to order posts by acf datepicker

I've read alot, I've tried a bunch of different things, I still can't get my query to order posts by acf's datepicker field. This is what my code looks like: $args = array( 'post_type' => '...
1
vote
1answer
3k views

how to fix error “called incorrectly, should not be accessed directly”?

Recently my woocommerce has been throwing errors all of a sudden. no changes were made to the website or server. When customers try to run a transaction, they get the following error "Transaction ...
0
votes
2answers
4k views

how to get post order by post id wp_query?

i have 4 post and i displaying 2 post per page. $ids = array('16085','16088','16083','16091'); $options = array( 'post_type' => $post_type, 'posts_per_page' => $posts_per_page, ...
0
votes
1answer
466 views

Multiple sorting criteries (order by)

I want my products to be sorted by price (ascending) and products, which are out of stock be placed at the end of the products list. How can I achive this in WooCommerce? Is it ever possible to ...
1
vote
1answer
113 views

How can I pick a single post from the latest 3?

I'm looking to display a single featured post from my latest 3 posts at random. I've managed to get it up and running picking any post at random just fine, but I want to filter it down to only the ...
0
votes
0answers
3k views

(woocommerce) How to get product id form order id & then retrieve custom meta linked to product?

I am having the a custom product type as shown below now when a customer purchases that specific product i want to retrieve allowed number of listing field. i can show that field in product page ...
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' => '...
0
votes
2answers
918 views

Sortable Custom Columns not sorting correct

I am using the code below to sort code as per meta_value. But in this specific Column I have dates displayed for example: 20 April 2018 or 01 June 2018 The sorting works sort of but now when I order ...
0
votes
1answer
174 views

Using Orderby and meta_value to order natural/alphanumerical

I added a custom column for a custom post type. Then I put it to be the 3th column, and now I want to sort it alphanumerical. I use this action : add_action( 'pre_get_posts', '...
-2
votes
1answer
238 views

Change Menu Order

I have read a post attempting to assist someone to reorder their menus in Word Press. I am new to all of this and immediately find great frustration. The advice given herein does not match what I am ...
-1
votes
1answer
301 views

How to make WordPress orderby work with post_excerpt column?

I can use WordPress in-built orderby to sort playlist by any column except post_excerpt echo wp_playlist_shortcode( array( 'ids' => '7,8,9', '...
0
votes
0answers
41 views

Loop random posts and display odd and even based on two alternating meta values?

I have a CPT containing an ACF select field for gender values Male or Female. I need to to display 6 random posts AND they need to be ordered so the odd posts are female and the even posts are male. ...
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 ...
0
votes
1answer
2k views

Orderby menu_order not working; menu is sorted on publish date

I have made a menu in the admin page ordered like this: parent - child 1 - child 2 - child 3 parent - child 1 - child 2 - child 3 parent - child 1 - child 2 - ...
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 ...
-2
votes
1answer
62 views

WordPress Not Sorting By Custom Field

I am trying to sort by a custom taxonomy, which is a rating, in my WordPress loop, however it is not sorting by number. If I sort by order 'ASC' then it will put those without a rating at the top - ...
0
votes
1answer
2k views

Custom post type sorting: alphabetical order

I want to display my custom post type "portfolio" in alphabetical order and I got it working fine with this code: add_filter("posts_orderby", "my_orderby_filter", 10, 2); function my_orderby_filter($...
1
vote
1answer
33 views

Issue with multiple orderby values

I am using this: 'orderby' => array( 'meta_value_num' => 'ASC', 'menu_order' => 'ASC' ), 'meta_query' => array( 'relation' => 'AND', array( 'key' => '...
-1
votes
1answer
134 views

Product atributes in title of order (not in description)

I have couple of variable products. When someone order product, some product displey in new variation format (where order atributes are in title). Image: https://user-images.githubusercontent.com/...
-1
votes
1answer
402 views

orderby and order filter in get_posts or WP_query function in wordpress not working

I have function in wordpress plugin which queries the posts using get_posts($array). But I wanted this to orderby post_modified field of the posts table in DESCENDING order, for which I have this code ...
1
vote
1answer
287 views

Sort order of next/prev sibling page

I have a page with a couple of children pages. On the parent page I want all children page listed alphabetically by title, but I want the sorting to ignore articles like "The" or "A". I achieved this ...
0
votes
1answer
707 views

WP Query - order posts by meta field first and then order the rest

I'm trying to order product post type with custom meta field for an expiration date. I want to show all the expiring products (first being the expiring soon ones). After them, I want to show all the ...
0
votes
1answer
101 views

Using abs() with custom field in orderby statement

I've a custom post type "ordered_post" and a few posts of this type. which they have an order to display and all of them have a custom field "custom_post_order". And they all are displayed in correct ...
0
votes
1answer
438 views

WP_Query: custom orderby (not ASC nor DESC)

How do I get a custom orderby in WP_Query (not ASC nor DESC)? So, order have to be not alphabetically, nor numerical. It have to be custom. For example I want to sort by post's meta field thing in ...
0
votes
2answers
977 views

How to sort (orderby) a query done by a template function before the 'foreach' loop?

How can I sort an array of elements being hold on a query done by a template function, just before the output starts on a foreach loop? I wanted to order my elements by the Post Title. Here is my code:...
1
vote
1answer
159 views

I did group my search results by post type, but how can i give each of them its own order?

I did group my search results by post type (artists, events, posts) and did put each of them in a container. The next step is give each of them it's own order within the container: Artists - From A-Z ...

1 2
3
4 5
14