Skip to main content

All Questions

Tagged with
0 votes
1 answer
75 views

Elementor - Sort by name

I have a website that lists paintings. All these paintings are made by various artists. I've added a custom post type "paintings" and created a form so each painting can be easily entered. ...
Systemedic's user avatar
1 vote
1 answer
142 views

query loop "inherit query from template" prevents setting sort order

I need all auto-generated category pages to sort oldest-to-newest I'm editing my "All Archives" template in block editor but I'm not having any success it contains a query loop with "...
Displayname71's user avatar
1 vote
0 answers
419 views

Compare ACF date field (if exists) and post date and order DESC

I have an ACF date field (same format as post date) and in my Query I want it to be compared to the publish date of the post: If erstelldatum is not empty use erstelldatum for order If erstelldatum ...
Omitheus's user avatar
1 vote
1 answer
29 views

Order By Post Type ThenBy Taxonomy

Assuming I have these custom post types: Product Video Article And for Product (WooCommerce Product), we have many Categories, one of which is called "Parts". I have this situation where I ...
wooncherk's user avatar
  • 111
0 votes
1 answer
294 views

Order posts ascending from posts in array

I have all my post id's in a specific array $productIds. When I want to show only these posts, I do this query: $args = array( 'post_type' => 'Product', 'orderby' => "...
Dennis's user avatar
  • 135
0 votes
1 answer
837 views

Move some posts to end of sort order, even if there is a sort in the wp_Query already

I have a site that lists properties for sale. I have a custom wp_query, with a sort dropdown I created. This dropdown reorders the posts query by date, price (low-high & high-low) and beds (low-...
user2115227's user avatar
0 votes
1 answer
175 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" => [ "...
user2812779's user avatar
0 votes
1 answer
714 views

Orderby event date (if it exists) or post date (if it doesn't) - how to reorder posts based on meta value OR date

I need a way to sort the posts on my tag and category archives according to the event date (if it exists) OR post date (if it doesn't). I have a combined archive for events and posts, but want to ...
jongoeson's user avatar
1 vote
0 answers
533 views

WP_query sorting can't sort danish letters (æ, ø, å)

I am having an issue, with making a WP query sort correctly, using danish special letters (æ, ø and å in this case). I have a loop running a query for certain post types, then returning them ...
Martin's user avatar
  • 21
1 vote
4 answers
5k views

sort search results by custom fields using dropdown

On my search.php page, I have a "Sort By" dropdown that almost works exactly how I want it to -- <select class="dropdown-class" name="sort-posts" id="sortbox" onchange="document.location.href=...
730wavy's user avatar
  • 193
0 votes
1 answer
128 views

Ignoring 'a' when sorting posts

I'm attempting to sort my posts on a page while ignoring 'a', 'an' and 'the'. I found a good example on this page: https://css-tricks.com/ignoring-the-in-wordpress-queries/ My Query $args = array( ...
Tom's user avatar
  • 153
0 votes
0 answers
39 views

New custom post type entries are not sorted correctly in admin using pre_get_posts

I am working on a WordPress plugin and trying to use the pre_get_posts hook. Everything seems to sort, but when I add new items through the back-end, they get added to the bottom and not sorted for ...
Michael Mann's user avatar
0 votes
1 answer
43 views

sort query results by newest

I wrote a query: WP_Query(array('post_type'=>'portfolio_item', 'post_status'=>'publish', 'posts_per_page'=>-5)); which works and does what I want except it sorts the results from oldest to newest, ...
brothman01's user avatar
2 votes
3 answers
2k views

Sorting Grids with Essential Grid and Events Manger

I am using Events Manager to control my Events, but Essential Grids to display previews of these events in various places throughout my site. An example of this is http://staging-dbmax....
Grant Smith's user avatar
7 votes
4 answers
3k views

Random sort within an already sorted query

I have a working query which returns a set of custom posts which are ordered by their package ID (ASC). For a query with 9 results this may return for example: 4 posts (Post ID's 1,2,3,4) with ...
David Clough's user avatar
0 votes
1 answer
1k views

Ascending & descending posts on same page with IF statement

I need to be able to display a list of events on 1 page. The top list would be for upcoming events and to be sorted with earliest event first and the second list would be for expired/past events and ...
ogmios's user avatar
  • 23
0 votes
1 answer
76 views

Sort / Filter Queries

I'm working on a website, that showcases products, and now I'm working on the query part. Basically I want to have one page, that displays a list of products as a normal query, and then on top of the ...
Forte259's user avatar
0 votes
2 answers
231 views

Sort Wordpress Posts Meta value by Week not Day

Right now I have a metakey called 'epicredvote', it sorts my posts by this epicredvote number. It is doing it on a daily basis at the moment, so if I have 2 posts the post with the highest epicredvote ...
mr. x's user avatar
  • 53
2 votes
1 answer
3k views

Query Set Order By Author

I am attempting to orderby the author_name when you click on the Author arrow on a list of tickets. When you click the arrow, the names are ordering by something I cannot identify. I want them to ...
ILikeTurtles's user avatar
2 votes
0 answers
78 views

Sorting posts alphabetical that have single digits

I have post titles that are like this: Episode 1 Episode 2 Episode 6 Episode 10 Episode 14 I try to list posts alphabetically but it ends up showing like this: Episode 1 Episode 10 Episode 14 ...
Ruriko's user avatar
  • 543
0 votes
3 answers
640 views

Re-sort get_posts query results

I have a query that pulls fields from the 3 most recent posts for a carousel: get_posts('posts_per_page=3') I need to re-order the results so that instead of it being 1, 2, 3 it is 3, 1, 2....
hml's user avatar
  • 1
1 vote
2 answers
1k views

How to orderby meta_value_num with dollar ($) sign

The custom fields all have prices including $ signs, and a dot as separator. $theQuery = new WP_Query(array( 'orderby' => 'meta_value_num', 'meta_key' => 'price', 'order' => ASC )); All ...
coder's user avatar
  • 45
1 vote
1 answer
6k views

Sorting posts according to view counts not working

I use the code snippet below to get views count of each post on my sidebar.php . everything works but the sorting does not. also it does not get 4 posts, it only shows 1 post although I've written '...
Payam Shakibafar's user avatar
0 votes
1 answer
1k views

How to manage a particular "order by" for get_search_query()?

How to manage in the search.php file the order of a posts search query managed with the following code <?php echo sprintf(__('%s Zoekresultaten voor ', 'website'), $wp_query->found_posts); echo ...
axel's user avatar
  • 161
0 votes
1 answer
497 views

Sort loop with query in the link

I want to add some buttons that will sort the post by name asc/desc etc. I want to use query in the link like this http://domain.tld/?orderby=name&order=asc Is this safe to use? Are there ...
CK13's user avatar
  • 45
5 votes
4 answers
29k views

Sort posts by category name and title

Trying to figure out how I can output my posts based on category title (a–z) and secondly, the title of the posts within the category: A CATEGORY – A post beginning with a – Because I want to be ...
INT's user avatar
  • 1,281
0 votes
1 answer
68 views

How to rearrange a pool of posts joined using two queries?

I need to select posts for two different months (current, past). As far as i know, it is not possible to pass m date parameter as an array of integer instead of an integer, so I am performing two ...
versvs's user avatar
  • 221
1 vote
1 answer
101 views

Wordpress Custom post query sorting does not work

I created a custom WP query to collect products that have 3 different taxonomy values in them and sorted them by price using the following: $my_products = new WP_Query( array( ...
Amit Wadhwa's user avatar
0 votes
1 answer
322 views

How do I sort multiples pages?

I want to use a dropdown to sort a list of posts in WordPress. The results will display on multiple pages. So how do I pass the query on to the second, third, fourth, etc. pages? Here's an example of ...
user23898's user avatar
6 votes
2 answers
3k views

Sort custom post type list table by display name of a user id stored as post meta value

I have a custom post type named domicile. Each post (domicile) has an owner (not the author). Owners are users with a custom role. I store the user id as a post meta value (dmb_owner) for the domicile ...
fuxia's user avatar
  • 107k

15 30 50 per page