Questions tagged [order]

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

Filter by
Sorted by
Tagged with
0
votes
0answers
31 views

Sort posts of a particular category based on custom date field value, and display in ascending order

I'm working on displaying a listing of posts that have a an advanced custom field Date Picker, and I need to display all upcoming posts in ascending order. So far I can get the wp_query to show all ...
0
votes
0answers
113 views

Order status still “Pending Payment” after successful payment (Custom payment gateway)

I was develop a custom payment gateway for woocommerce, everything is good but after payment success the order still "pending payment" In the __construct() function I check for payment provider ...
0
votes
0answers
55 views

how to find the right hook to change the woocommerce order refund textbox

im trying to change this text box into dropdown box, but i cant find the right hook, or can you help me how to find a hook for this one, heres my sample code add_action( '...
0
votes
0answers
38 views

Meta query orderby meta_value_num sorting by role first

I want all of the results to order by meta_value_num, but it's ordering by role first. How do I get them to ignore the role order? Here's my code: $user_query = new WP_User_Query( array( '...
0
votes
0answers
35 views

WP_User_Query Orderby Not Working

If I use the following code, I can retrieve users in the correct order: $user_query = new WP_User_Query( array( 'role__in' => wp_parse_list( $atts['userrole'] ), 'meta_query' => ...
0
votes
0answers
30 views

Change the customer's name to a link on an order management page

Inside the admin control panel, on an order page where I see all the details of the order. I see a list of things: customer name, phone, address, email, etc. I'm trying to change the client's name to ...
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' =&...
0
votes
1answer
57 views

Custom post type order by post_title

I got a custom post type called "employees" and this is the query I use with FacetWP (plugin we are using). We want to sort the employees by post_title. <?php return [ "post_type" => [ "...
0
votes
2answers
38 views

Order custom taxonomy hierarchy

I have some custom taxonomy for regions. Commonly it would look something like this. USA (parent) - Arizona (child 1) - - Phoenix (child 2) however, there will be cases where it will only be like ...
0
votes
1answer
80 views

How to save one API response to WooCommerce order meta data

Have one custom checkout field email type that validates if the email exists or not in a remote server. I sent JSON data to the remote server with this field. If email exists JSON response typically:...
0
votes
0answers
22 views

I want to get latest one post of a particular category

I want to get the latest one post on counting View Count. Latest I have tried this but didn't get the result : $popularpost = new WP_Query( array( 'post_type' => 'post', 'posts_per_page'...
0
votes
0answers
15 views

SEARCH QUERIES - REVERSE OUTPUT

When I perform a search on the WP admin side for my custom post query I am returned with the most relevant queries first. Great However, performing the same search on the front end of the site and I ...
0
votes
0answers
16 views

Using date stored as custom field to order posts

I have a custom post type "travel" and a custom field "data" (date format j F) and I would like to see all the posts in order by the custom field "data". I think I have to transform it into timestamp ...
0
votes
1answer
79 views

query posts custom field calculation value

I have a front-end form whereby users create a post and input 3 numerical custom field value` as part of their post. These 3 custom fields are then calculated and the result is displayed in the post....
0
votes
1answer
21 views

order custom post type posts by custom date

Trying to order posts by a custom field, where a date i stored. The date looks like this "03.10.2019". All of the below function works properly, but the posts are sorted by post date, not custom field ...
0
votes
0answers
22 views

Multiple orderby date arguments

I've had good luck with using multiple orderby arguments in the past, but now that I'm trying it with dates I'm wondering if there's something I'm missing. I'm trying to order some posts by an ACF ...
1
vote
1answer
73 views

Order wordpress taxonomy parent terms by their children count

I need to order parent terms by their children count: function sort_terms_by_children_count ( $terms ) { $sort_terms_by_children_count = array(); foreach($terms as $term) { $count = ...
0
votes
1answer
8 views

How can I order these pages in this navigation bar on this old wordpress theme?

It's using a superceded theme with no support. Even so, the theme has been working great for about a decade... Here is the site: https://www.vertebr.ae There is no menu to organise in the ...
0
votes
1answer
22 views

Order posts by meta key ( Using ACF )

Hey I am using ACF in media library and want to sort media by meta key (that is actually created by ACF). BUT it is not working. Here is the code: $gallery_imgs = get_posts(array( 'post_type' ...
0
votes
1answer
75 views

Order by value of Custom Field using url string

I have a simple dropdown: <select class="dropdown-class" name="sort-posts" id="sortbox" onchange="document.location.search=this.options[this.selectedIndex].value;"> <option disabled ...
0
votes
1answer
68 views

query posts with selected post ids first

Is there a way I can get most recent posts with a couple of posts I specify by post ID listed first? According the docs, the order and orderby parameters may be passed as an array, so in theory I'm ...
0
votes
0answers
14 views

Sort posts by number of times tagged [duplicate]

Let's say I have a custom post type Books, and I tag the books with a custom taxonomy "Person". The taxonomy contains the name of a person and basically means the person has read that particular book. ...
0
votes
0answers
37 views

WordPress Admin - Automatically Sort Custom Posts by Custom Field Date Value in d-m-Y Fomat

I have a custom post type called 'Courses'. I'm currently trying to automatically display them in the dashboard 'Courses' post list sorted by a date value specified in a custom field. The date value ...
0
votes
0answers
36 views

how to complete order status automatically after paypal payment received

we are using paypal payment gateway for payment we want autocomplete order status after payement received how we can complete order status automatically is there any plugin
0
votes
1answer
838 views

How to get woocommerce selected variation from order object

Iam trying get selected variation from order. global $order; $items = $order->get_items(); foreach( $items as $item ) { $product_id = $item->get_product_id(); $product = wc_get_product(...
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 (...
0
votes
1answer
11 views

Order by meta date with a thousanth of a second defaults to post order

I have a custom post type query: $paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1; $args = array( 'paged' => $paged, 'post_type' => 'my_custom_post_type', '...
0
votes
1answer
290 views

Taxonomy list. Order by a specific custom post type count

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 posts type count of taxonomy. Taxonomy list is ordered by post count. ...
0
votes
2answers
72 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
137 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
54 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); ...
0
votes
1answer
52 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
429 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
37 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
1answer
900 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[...
3
votes
2answers
877 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 ...
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 ...
0
votes
0answers
1k 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
498 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' => '...
1
vote
1answer
63 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
25 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
35 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
124 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
20 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
632 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
1answer
46 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
288 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 ...
0
votes
3answers
634 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' => ...

1
2
3 4 5
14