Questions tagged [sort]
The sort tag has no usage guidance.
529
questions
0
votes
1
answer
598
views
How to sort posts in admin by name
I have created a multiple posts on my blog and now I want to sort them, for example, by name.
But as I see, the post with the newest ID is always on top of the list and I cannot sort the posts in the ...
0
votes
1
answer
658
views
Sort posts by custom fields with empty values
I'm trying to list a few post sorting by a custom field value ("space-comments"). It's working very well, however, when the custom field is empty the loop don't get this post.
Any idea to fix it? ...
0
votes
1
answer
1k
views
WP Tax query & order by tax query not working
I have subcategories(custom taxonomy).I want to fetch all products of that category in one table & then other category name & it's table.
To achieve this,I grouped by & ordered by custom ...
1
vote
1
answer
848
views
Sorting category products not working
I am using Avada theme and the sorting of the products on category page is not working. When i click on ascending and descending order the ordering of the products becomes random.
Please provide me ...
0
votes
2
answers
1k
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
2
answers
2k
views
Trying to sort and display categories(not posts) by custom field: 'order'
I'm a WordPress rookie. I've added a custom field to my "Category" taxonomy. The custom field is "custom_order" and its purpose is to hold a number so that my categories can be sorted and displayed in ...
0
votes
2
answers
19
views
Next/Previous Product with custom order by price & products inside the product category [closed]
How to create next/prev buttons that are price sorted and give results inside the product category you are in?
This question has been asked multiple times and despite the multiple threads there wasn't ...
0
votes
0
answers
30
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 ...
0
votes
2
answers
2k
views
Make custom post type column sortable
My site has two custom types: Auction and Lot. Lots are connected to an Auction via the post_parent field. I added an Auction column to the Lots list in the admin area.
function ...
0
votes
1
answer
898
views
Sort categories by meta value
How can I make a list of categories with 4 last posts in each where every category is sorted by meta_value.
For example, template without sorting by meta_value is http://pastebin.com/AeH6vx9b
It ...
37
votes
11
answers
25k
views
Can the Next/Prev Post links be ordered by menu order or by a meta key?
I have a series of posts that are ordered by a meta_key value. They could also be arranged by menu order, if necessary.
The next/prev post links (generated by next_post_link, previous_post_link, or ...
2
votes
1
answer
725
views
Meta query with order by another custom field
Edit: I will try to explain in detail my problem.
I am working on a portfolio site. There are a few custom post types: Projects, Publications, Exhibitions, Lectures and Slides. Home page consists of ...
0
votes
1
answer
32
views
Sort users by meta key value even if meta key not present for all users
Only some users have a specifice meta_key some_metakey associated with their ID.
The following args successfully orders users with a specified role by some_metakey but only those with that meta_key.
...
1
vote
1
answer
860
views
Sorting Custom Posts on Archive page with pagination
I've got custom taxonomy archive pages with a drop down list that allows users to re-order/sort the posts. It basically waits for the user to select from the drop down then uses array_merge( $wp_query-...
1
vote
2
answers
6k
views
manage_edit-{post_type}_sortable_columns sorts, but wrong!
Good afternoon!
This is an issue regarding the Wordpress backend and custom post types. I have spent all Friday searching and trying possible solutions and, while they helped others, in my case they'...
0
votes
1
answer
1k
views
How to sort custom post's category by id from the theme's function.php?
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
1
answer
2k
views
How to change custom post order ASC/DESC menu_order wise dynamically?
I have created custom post type in back end with sort menu_order post as you can see in the screenshot. http://prntscr.com/gacw95
In back end sorting ASCENDING/DESCENDING working fine.
But I need to ...
0
votes
1
answer
14
views
WP_Query, Taxonomy, list of attached items to a Term, sorted
I have a Taxonomy, “Genre”.
“Genre” has a Term, “advert”.
I want my taxomomy template to grab all Custom Posts attached to that term, sort them by my last_name, first_name, short_title Custom Fields, ...
0
votes
0
answers
15
views
How to order query results based on if a custom field has been populated, then the order by the date of the post?
I am trying to custom sort a query for product posts (custom content type) based on if a specific ACF custom field for a product ID number has been populated. My client wants to feature products with ...
0
votes
0
answers
9
views
Sort query_terms_list for post_tags alphabetically
I have the following array that currently sorts tags by tag count and returns the tags with the individual tag count. I would like to keep the individual tag count but sort the tags alphabetically ...
0
votes
1
answer
1k
views
ORDER BY custom field value out of where clause
Based on example here https://make.wordpress.org/core/2015/03/30/query-improvements-in-wp-4-2-orderby-and-meta_query/
I'd like to modify the query
$q = new WP_Query( array(
'meta_query' => array(...
4
votes
1
answer
414
views
How to Arrange Posts by Size in the WordPress Dashboard?
This may be a lame question, but I can't find an answer to this.
Let's say you have a ton of empty posts that you want to delete. Obviously those who have some content will have more size.
Is there ...
0
votes
1
answer
1k
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
1
answer
704
views
How to sort by meta value num, but ignore zero value?
I have custom-post-type company and taxonomy services for this CPT.
I have created meta-field service_[id]_price for companies and fill this field with a number. If this company has not price for this ...
0
votes
3
answers
1k
views
Custom post type taxonomy not sorting correctly
i created a custom post type and also some taxonomy to be able to perform sorting on the display list.
It is all working well on my local testing installation but as soon as i put on the production ...
1
vote
1
answer
2k
views
Changing WP_Query params with url Query Var
:)
I've used WP_Query to display there posts (travels) here http://boost19.delavec.si/wordpressP/produkti/
So... I've got this WP_Query that is looping through my custom posts
<?php $paged = (...
0
votes
2
answers
1k
views
Custom Woocommerce Product Query
I work on a project that shows some travels (depending on the destination category). I try to sort the travels on the start date (var_confirmed_date) but the result is the same as no sorting.
Here is ...
0
votes
2
answers
10k
views
How can I sort get_users() by any value (last_name, user defined fields and more)
I want to sort the result of get_users() by last name, first name, user defined fields or whatever.
How can I achieve this while still using get_users()?
0
votes
0
answers
18
views
Table Sorter sort by span title?
I'm using table sorter plugin to sort a table on my website.
One column has only unsortable signs as content.
However I'm trying to sort this column by value.
It's the column IMDb here: https://...
0
votes
1
answer
31
views
Sort scheduled posts in ascending order by default
I have a self-hosted WordPress blog (5.9). When I go to view scheduled posts, I want the default sort order to have the soonest scheduled posts on top.
I can do this by manually hitting the date ...
0
votes
0
answers
14
views
How can i sorting and display image order by siz in media library?
How can i sorting and display image order by size in media library?
Sorting is important for me?
Any one can help me please?
0
votes
2
answers
25
views
Custom Post Type page sorts differently on different environments
TLDR: My custom post type items are sorting differently on a local environment and a live server. Can't figure out why!
I have a local install (MAMP) and an online dev install (GoDaddy shared, for the ...
1
vote
0
answers
23
views
How to enable sorting in custom media uploader in plugin
In my plugin I need a media uploader exactly like the one you see when you select a post's featured image.
I managed to do almost everything with this code:
media_uploader = window.wp.media({
...
1
vote
1
answer
141
views
Show Primary Category first when I display post categories
I created some custom taxonomies in Wordpress and when I want to show the categories for a custom post type on the frontend, they're listed in alphabetical order.
Is there a code for functions.php ...
13
votes
3
answers
16k
views
Make custom column sortable
I have a added custom column to a custom post type, and it works fine. I just want it to sort the names by title, so I tried this,
function sortable_custom_columns( $columns ) {
$columns['...
0
votes
0
answers
34
views
(WP List Table) How to sort by SKU and Custom Fields?
I created a custom plugin for a client to show all products in a Table. He wants to be able to sort by SKU and some custom fields.
I am using wc_get_products() to fetch the data.
public function ...
0
votes
2
answers
6k
views
how to get post order by post id wp_query?
I have 4 posts and I displaying 2 posts per page.
$ids = array('16085','16088','16083','16091');
$options = array(
'post_type' => $post_type,
'posts_per_page' => $posts_per_page,...
0
votes
2
answers
77
views
Posts sortable column not sorting properly for custom field numbers
I have a custom field for view counts that are stored as numbers. I added a Views column, and made it sortable, but they are not sorting properly.
The results when I click on the Views column are ...
1
vote
1
answer
24
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 ...
0
votes
0
answers
56
views
Customize the Sorting Dropdown in WooCommerce use another list or more page
it would be great if there was a way to change the default sort by dropdown in WooCommerce on the shop page. but I want to use list page or other page for default sort by dropdown in wp-query.
0
votes
1
answer
47
views
Sort custom posts by date and then by taxonomy
i am having this issues for month and i can't figure out how to solve this one:
I am working on a website, where you can check out cultural events in my region. This is just to let you know of what i'...
0
votes
0
answers
82
views
Order (by ASC) posts with meta_key so posts without values are last
I am trying to figure out sorting posts with prices in one meta query, so the posts without prices are shown last, when ordered by ASC and not first.
Right now I am temporarily not showing posts ...
5
votes
1
answer
5k
views
Ordering posts by custom taxonomy in admin area
EDIT
@kaiser - this question is slightly different to the answer you posted in that I am talking about sorting by clicking the column title rather than adding a dropdown to filter by taxonomy term (...
0
votes
1
answer
183
views
Sort categories by custom field in WordPress admin
I know there are a lot of threads about similar issues, but I can't figure out why my custom sort won't work in the category admin page. Here is my code to add the ACF field as a column to the ...
0
votes
1
answer
598
views
Wordpress sorting posts by date and title using a dropdown
I'm trying to set up a dropdown that would sort my posts by Newest to oldest and Alphabetical.
This is what I have so far:
I'm declaring an empty variable, then a form where I can change the contents ...
20
votes
3
answers
54k
views
Sort results by name & asc order on Archive.php
I currently use the following code to list posts in Archive.php but I want the results to be ordered by name in ascending order, I have checked the codex but the answer isn't clear to me, how can I ...
0
votes
1
answer
554
views
Sort products by Sale price and stock status
I want to sort products by sale price and in stock and regular price at first but doesn't find solution anywhere. Here is what I have implemented and didn't get the solution:
add_filter( '...
0
votes
0
answers
115
views
How to sort store location by specific category order in WP store locations
i want show if store has specific category then should be show in first and then order by distance
add_filter( 'wpsl_sql', 'custom_sql' );
function custom_sql() {
global $wpdb, $wpsl_settings,$...
5
votes
4
answers
27k
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 ...
0
votes
1
answer
191
views
Woocommerce - Problem sorting and filtering products with different tax rates by price [closed]
Setup (wordpress and woo only; fresh install):
Prices entered with tax: No, I will enter prices exclusive of tax
Display prices in the shop: Including tax
Display prices during cart and checkout: ...