Questions tagged [order]

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

Filter by
Sorted by
Tagged with
0
votes
1answer
747 views

How to sort custom post's category by id from the theme's function, without using a plugin?

I'm wondering how to sort a custom post's categories in the selection field which I've circled in the screenshot? And I have the following code which generates category listing $args=array( ...
0
votes
0answers
32 views

What's the most efficient way to get two queries based on an if statement?

I want to retrieve all custom posts with a specific custom taxonomy term, and order them by a particular custom meta field. However, I also need to cater for when the orderby field is empty, and in ...
0
votes
1answer
1k views

How do order product categories - on a parent category page - in Woocommerce?

I am using Woocommerce with Wordpress. Woocommerce allows you to create product categories. In addition You can set all those categories to have a specific parent category. That way you can go to the ...
0
votes
0answers
11 views

“order” does not affect order of custom query

This is my custom post type: 'label' => __( 'Person', 'text_domain' ), 'description' => __( 'Post Type Description', 'text_domain' ), 'labels' => $labels, '...
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. ...
0
votes
1answer
3k views

get_total () returns 0 - woocommerce [closed]

I have some function to get order total value. I have a problem, because get_total(); allways returns 0. I need order total value from backend admin > order details. When i check files i found some ...
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 ...
2
votes
1answer
5k views

WP REST API: Order posts by meta value (acf)?

I'm requesting posts with the WP REST API and need to sort them according to an ACF field. It's value represents a date (numeric, jQuery date format yymmdd). I know how to do it with a normal WP_Query ...
3
votes
2answers
753 views

Identifying the priority of style.css so I can make a small CSS file load last

I have a small bit of hourly-changing css and I want to keep it in a second file (apart from style.css) and load it after my theme's style.css file. I believe I can make it load before style.css by ...
0
votes
1answer
82 views

Allow reader to reorder posts for themselves (oldest first)

Would be great if you could point me in the right direction with this: Be default, I want my blog to show posts in the traditional newest first -order, however, it would be good if my readers could ...
0
votes
1answer
349 views

How to Create a Random List of Child Pages

I have a site that has Parent and Child pages. I want to be able to show a list of the child pages, listed in Random order. In addition I want to limit the number of child pages shown. I have found a ...
0
votes
1answer
194 views

Pin to Top Functionality using orderby custom field then event date

I need to accomplish the following: pull CPT tribe_events sort by custom field "pin_to_top" in DESC order get posts from today's date & any in the future sort remaining posts in ASC order My ...
0
votes
1answer
1k views

query_posts based on a meta_key

I have custom post type of brand and custom field generated via types plugin, wpcf-sorter trying to manually create a field to sort my posts. Some of the posts have this custom field populated with a ...
1
vote
2answers
2k views

Wp query orderby 'title' doesn't work

I would like to order a list of post title alphabetically. I am using this specific query // WP_Query arguments $args = array( 'category_name' => 'reportage', 'order' =&...
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): ...
0
votes
1answer
595 views

Sort posts by meta value with get method

I have custom post type with meta values added by Advanced Custom Fields. I want to sort posts with get method by this meta and by post_date. I make some code but it is works strange way - it didn't ...
0
votes
1answer
29 views

How to change the order of the Front Page so it doesn't appear first

I have a Portal page and also a Home page. The Portal page is very basic and has a handful of links linking to different systems, one of the links leads to the Home page of WordPress. I want the ...
0
votes
1answer
570 views

Problem ordering posts with numbers for titles numerically E.g. 1, 10, 100

I have posts that are named from 1 to 25. But, the WordPress ordering system doesn't work correctly. It orders them as 1,10,11,12,13...2,21,22,23,24,25. I don't want to add 0 to 1-9 numbers. How can I ...
2
votes
2answers
428 views

Wordpress Ordering Problem. How to fix ordering 1-10-100 issue?

I have categories the names of which are 1 to 25. But the WordPress ordering system doesn't work correctly. It orders them as 1,10,11,12,13...2,21,22,23,24,25. I don't want to add 0 to 1-9 numbers. ...
0
votes
1answer
226 views

Order by 's' using WP_Query()

I have a wp query like this, $args_search = array( 's' => "string1 string2 string3 ..", 'post_type' => array( 'post' ) ); $wp_query = new WP_Query( $args_search ); This will search for ...
-1
votes
1answer
699 views

Woocommerce custom taxonomy order

I have a custom order of my taxonomies in Woocommerce/Taxonomy Order. When I display them, they get printed in alphabetical order. How can I prevent this behavior and print them in the order I ...
1
vote
1answer
292 views

SQL: What is wrong with the following query (generated by WordPress WP_Query, ordering prices)

Hey there I have the following SQL Query which is generated by WP_Query numeric meta query: SELECT SQL_CALC_FOUND_ROWS wp_postmeta.meta_value FROM wp_posts INNER JOIN wp_postmeta ON ( wp_posts.ID = ...
1
vote
3answers
6k views

Automatically remove a canceled order in Woocommerce

Been looking around on this website and the internet but can't seem to find a solution. My client wants every order which has the order status cancelled to be completely removed out of WooCommerce ...
1
vote
1answer
63 views

Order WP_Query by multiple fields, subtracting them from one another

I have two custom fields for each post, vote_up and vote_down. I know how to order by one of them, but I'm wondering how I can get the totals of both, subtract vote_down from vote_up and then display ...
8
votes
2answers
39k views

WP_Query orderby date not working

I have a simple WP_Query to get a list of posts of co-author (taxonomy author) order by date, this is the query : $username = get_the_author_meta( 'login', $author_id ); ...
3
votes
1answer
534 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 ...
0
votes
1answer
385 views

Random order of the 5 most popular posts

I have a loop that shows the most popular posts with the meta_value_num. I'm trying to randomize the order of the most 5 popular items. Any idea why this code isn't working? <?php query_posts('...
1
vote
2answers
192 views

Order By table field comment_status in WordPress > 4.0

can anyone help me to sort Posts list in WP-admin by wp_posts table field like comment_status. I know, that we can easy sort by meta field key, but cannot find any way how to sort by wp_posts table ...
0
votes
1answer
29 views

Display three sequential posts on each page load, without repeating previous

I am using a custom post type to manage adverts on a website. There are 3 identical ad spaces on each page, output via WP Query. Could someone please suggest, on a high level, an approach to show 3 ...
-1
votes
1answer
5k views

WooCommerce: Order Details Table > Add Product Meta

I would like to modify the tables with line-itemed product info for 1) Order Details 2) Cart 3) Checkout Review 4) Order Email. Specifically, I would like to add a custom field (e.g. via get_post_meta)...
0
votes
3answers
1k views

wp_list_pages sort order by top nav menu order and child of

Im trying to show a box on left sidebar with links of current page's sub menus. but order is not applying same as menu! whats the problem? <div class="sidebar-box"> <div ...
0
votes
1answer
128 views

Order terms by creation date

How can I add the order by date created to this function? if ( !isset( $gmw['search_results']['custom_taxes'] ) ) return; $taxonomies = apply_filters( 'gmw_pt_results_taxonomies', ...
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 ...
0
votes
1answer
508 views

Order posts by more than one variable (meta_key and publish date AND time)

At cascadeoc.org/results I have results sorted by a Custom Field, "event_date_results" which is the date the event happened (not the date the post was published). However, when there are multiple ...
2
votes
3answers
3k views

How to use order RAND() on Wordpress?

Attention: It's order, not orderby. According to wordpress docs, there are only two options to order, which are ASC or DESC. The problem is: I would like to randomize the posts I've selected, not ...
1
vote
2answers
116 views

Advanced ordering of query_posts

I'm working on a rather large and old Wordpress project where someone has previously used query_posts all over the place. For this reason, I'm unwilling to change those method calls. I'm not the ...
1
vote
2answers
189 views

Reorder displayed posts with JQuery (title A-Z / last posted)

just wondering if anyone came across this: I have a front page featuring artists in a square grid, now the client asks for a switch button to reorder the artist from A-Z (based on artist name) to the ...
2
votes
1answer
1k views

Why wordpress popular post widget shows Undefined index?

During making a popular post widget I see this notice: Notice: Undefined index: popular_posts_order_by in /hermes/bosnaweb09a/b2039/ipg.tutorialcoursecom/arifhossin/wp-content/themes/testtheme/...
4
votes
1answer
3k views

Sort post by attributes 'order'

How to sort the displayed posts by attribute "order"? In functions.php I added the "Attributes" for posts function wpzen_add_attributes_to_post() { add_post_type_support('post', 'page-attributes'...
1
vote
1answer
222 views

Complex Orderby Parameters: How to query with multiple orderby parameters using meta_value_num?

This are my current parameters for WP_Query: array(5) { ["posts_per_page"]=> int(6) ["orderby"]=> array(2) { ["uss_product_price"]=> string(3) "ASC" ["uss_product_weight"]...
0
votes
1answer
160 views

My custom query is displaying random posts in random order

Edit: Answered below Here are my args when returning posts from a custom taxonomy: $args = array( 'post_type' => 'products', 'orderby' => 'date', 'order' => 'DESC', '...
0
votes
1answer
737 views

Create custom order sortby based on array of id

im working on custom order sortby based on array of id from drag drop post.. i manage to get the id's from saved settings.. for example i have Array ( [0] => 8701 [1] => 11301 [2] ...
1
vote
1answer
71 views

Author list 'special' author first then 'normal' author

Currently I'm trying to create a author list with all authors but on top some 'special' authors. The 'special' authors should result first and shouldn't be available in the list with normal authors. ...
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=...
0
votes
1answer
158 views

Best way to sort posts with different types by distance

I'm working on a project that I need to We have x posts, 1 Sponsored (custom meta field), unlimited paid, unlimited free posts (these are types of posts) We need to show 1 sponsored at top, ...
4
votes
0answers
700 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)...
0
votes
1answer
409 views

Comments form custom fields order

I'm trying to add 5 custom fields to comment form. Just use 2 hooks to display custom fields after default fields - 'comment_form_logged_in_after' and 'comment_form_after_fields' like this: function ...
1
vote
2answers
765 views

Query random post from different categories

I have six regular categories, not custom (each category having between 5 and 10 posts) and I am trying to display one random post from each category on the page. The problem with the output is ...
0
votes
2answers
63 views

Adding scripts before plugins scripts

I have a site which uses Google's API's for jquery and a fallback for jquery. The problem is that I can't get the fallback to happen immediately after the jquery api attempt. What happens is that the ...
2
votes
1answer
775 views

Sorting posts by multiple values, combined

In this image, 1. The Black letters are default post titles 2. The number before the 'of' is a custom field. 3. The number after the year is the post's published year Now I want to sort this ...

1
3 4
5
6 7
14