Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [order]

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

0
votes
0answers
6 views

How to replace name of shipment method with another value in dashboard / order?

I've created a shipping method that fetches a servicepoint (location/store) when entering street and postal code. That works at the frontend. The shipment method is called DHL Sweden. When I go ...
0
votes
0answers
8 views

WooCommerce sorting-order in responsive layout wrong

I have a problem with my main WooCommerce-Shop page: I have 6 products in it, which should be sorted by names as follows: 1, 2, 3, 4, 5, 6 This works fine on a PC or Device with a large display width (...
0
votes
1answer
89 views

Taxonomy list. Order by a specific custom post type count ( Please help)

I have a custom taxonomy and two custom post types (A and B post types). I created a taxonomy list and this list also display B custom posts type count of taxonmoy. Taxonomy list is ordered by post ...
0
votes
2answers
32 views

wp query multiple values > display a specific value first

I have a query that get relationship fields for multiple ID. I get the ID of selected item, and merge it in an array with other ID's ex : my page relationship ID = 5 my other pages ID in array = 6,...
0
votes
0answers
26 views

Sorting Tag Cloud by Popularity

So I have the default Wordpress Tag Cloud Widget on my sidebar/footer and I found the following code to limit the number that it's showing because it took up a ton of space. This code however is not ...
0
votes
1answer
51 views

line order number start numbering from second line (SOLVED)

if(is_tax()) { $currentTermType = get_query_var( 'taxonomy' ); $cat_icon = get_field('logo', $queried_object); ...
-1
votes
0answers
12 views

How to best trigger a failed order from frontend checkout in WooCommerce? [on hold]

I am working on a project that requires to create logic for when a user fails an order when checking out. Since I am testing on local with a test WooCommerce installed, what would be the way for me to ...
0
votes
1answer
22 views

WP Query with meta queries

I have the following WP_Query: $query = new WP_Query(array( 'post_type' => 'some_cpt', 'posts_per_page' => -1, 'meta_key' => 'active', 'meta_value' => 1, '...
1
vote
1answer
34 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 ...
0
votes
0answers
8 views

Infinite scroll posts order

Is it possible to give an order to the posts when they are loaded paged and by using infinite scroll effect without a plugin? I'm asking this because I'm using the masonry grid provided by bootstrap 4 ...
0
votes
0answers
33 views

Order Element By Custom Field in Wordpress

I'm working on wordpress and I want to order my post by rating. I'm new with it, and I need some help. I tried many things, but seem it's not working :/ My Wordpress Custom field which contain the ...
0
votes
0answers
10 views

Dokan Muti Vendor Plugin - Change commission of vendor after order has been synced

I did not set the admin commission (read: it was 0%) when the website went live so right now no vendor has any commission. I have around 120 orders and I need to set commissions each vendor received ...
0
votes
1answer
19 views

How to order WordPress Rest API data

I am pulling in some data via the Rest API: https://legalsecurityforum.com/wp-json/wp/v2/speaker?include[]=3116&include[]=3249&include[]=3170&include[]=3416&include[]=3181&include[...
2
votes
2answers
133 views

Meta query interfering with orderby relevance

I'm trying to re-order the search results using the pre_get_posts hook and set the orderby parameter to relevance. I also want to put priority posts, which is based on post meta _prioritize_s to be ...
0
votes
0answers
60 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 ...
0
votes
0answers
166 views

How to override WooCommerce Order Item Meta with data from Cart?

I have the following function that is overriding some of the values that are saved to the Cart and Checkout, via the YITH Bookings plugin. Essentially, I have overridden the Duration field with my own ...
0
votes
2answers
43 views

How to get_posts where 'menu_order' is more than 0/zero?

Is it possible to get posts where menu_order is more than 0? I have tried this argument when I get_posts() but it doesn't have any effect at all: 'meta_query' => array( 'key' => '...
0
votes
0answers
110 views

Adding Geolocation Map to Shipping Address in WooCommerce

I'm trying to add a Map into the Shipping Address in an Order with WooCommerce app, for some reason I had to use the legacy Rest API v3 (/wc-api/v3), and I figured out how to send GeoLocation from ...
0
votes
0answers
39 views

Replace Order product quantity with custom meta

I am using the awesome Uni CPO plugin for custom product attributes and pricing formulas. The plugin works great, however (for personal reasons) I am using the Select input fields for my custom ...
0
votes
0answers
18 views

order status not getting assigned properly for paypal payment

Scenario I'm using paypal sandbox account for payment right now and I've set it up correctly , the order is getting successfully placed if I use paypal payment while checkout. But the status should ...
1
vote
1answer
55 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 ...
0
votes
0answers
24 views

meta_query orderby sort multiple keys

I'm trying to read the birthdays of the users in my database through custom fields that have been added. Displaying the current months is easy but I am trying to capture the current month(remainder) ...
0
votes
1answer
31 views

How to always display a specific post from the search result first

I created a search filter that displays posts randomly, and I wonder how can I always display a specific post item in the first position of the search results and display the rest of the items ...
0
votes
1answer
63 views

Debugging wp_query orderby for taxonomy

I cannot seem to find where WP_Query adds the orderby clause to a SQL query. I am using this code: function wpd_team_taxonomy_queries( $query ) { if ( !is_admin() && $query->is_tax( 'team'...
0
votes
0answers
15 views

Query Order By Number Variable From API

Trying to order the query by a number variable $total that is a storing an api containing a number. My goal is to output an ordered list with the number ($total) sorting the list. I've looked around ...
0
votes
0answers
21 views

How Can I Save This Re-order action?

I have a code that I'm working on to enable a user to manually order posts in a custom post type, a lot of the code I basically copy-pasted from an already-existing plugin that has this functionality, ...
0
votes
0answers
119 views

How to get_comments() ordered by date and parent?

So my starting point is: <?php $comments = get_comments(array( 'post_id' => $post->ID, 'status' => 'approve', 'type'=>'comment', '...
0
votes
0answers
50 views

WP Query to order posts with a specific meta value first

I am trying to write a WP post query to get all posts which have a certain meta key, but with those which have the key set to a specific value to show first. The query modifications are in a ...
0
votes
1answer
20 views

How to order multiple custom post types with same taxonomy by date

I am using this code to display list of multiple custom posts by same taxonomy and order them by date publishing. But somehow it mixed the order. The live example: https://planetaudio.hr/novo-u-...
1
vote
1answer
176 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
18 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?
0
votes
0answers
9 views

WooCommerce change product in order

It's less a coding question and more of operating question. When I am trying to edit an order and I want to add a variation, I can only add the variable product. For example, if I want to add "...
1
vote
0answers
27 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
147 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
44 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). ...
2
votes
4answers
818 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 ...
0
votes
0answers
57 views

Adding additional information to Admin Order Preview

Looking at adding the actual shipping costs of an order to the order preview pop-up. I think we have to use add_action with woocommerce_admin_order_preview_end and maybe even using add_filter to ...
1
vote
1answer
56 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
0answers
17 views

Need a Plugin for Sorting Specific Category Posts within a Static Page

I am NOT a strong PHP coder and mainly create sites using plugins and custom CSS which I am strong at. I have a page listing posts from a specific category. The page is built using Elementor Page ...
0
votes
0answers
160 views

Woocommerce 'order_by' random with 1 hour seed refresh

I need my woocommerce products to display randomly. My products are actually people and the random element is so different people get seen on the first page so no-one is favoured. So, I have ...
0
votes
0answers
64 views

Featured posts reordering without plugin - Newspaper theme

I am using Newspaper (child) theme where the 2 carousels display the 11 featured posts (first 5 in the main carousel and the following 6 in a secondary carousel). We used to use a plugin to reorder ...
0
votes
0answers
73 views

In get_terms, orderby meta value not working with child_of

Here are my terms query and args. $termArgs = array( 'taxonomy' => 'category', 'hide_empty' => true, 'orderby' => 'meta_key_num', 'meta_key' => 'belCount', '...
0
votes
1answer
86 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
22 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
28 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
0answers
70 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
110 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
269 views

Woocommerce: sort by price and sku - combination of meta values

I'm trying to sort products by price, but have them sorted by sku and not by id for a specific price. So if there are 10 products with the same price, they should be ordered by sku instead of id. I ...
0
votes
0answers
56 views

Woocommerce merging cart and checkout page together

I've go an idea to merge cart and checkout pages into one. Doing it by moving files produced errors but i found a simple, yet effective solution. In order to make cart and checkout page as one, all ...
0
votes
0answers
23 views

Order by date with more than one meta key in Wordpress query

I have a list of events and they all have either a 'start date' or 'date'. I am trying to list the events in order using either field depending on which is filled out but am having no luck. I tried: $...