Questions tagged [sort]

The tag has no usage guidance.

0
votes
0answers
11 views

WooCommerce Custom Query with high/low pricing and paging

I created a custom query in my template to show certain products. I would like to add a sort feature for pricing ascending and descending but have not had any luck. Here is my code on my template: &...
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
0answers
13 views

show count and sort by curtain post type in taxonomy list

i have a taxonomy list with post count and it sorted by post count. but i want taxonomy list to show only curtain post type count and sort by ount of this post type this is my code function ...
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, '...
0
votes
0answers
21 views

Order by WooCommerce product attribute doesn't work on search page [closed]

I'm using Advanced Woo Search Pro version search plugin and I am sorting using custom product attributes, it works fine on product page but on the search result it doesn't show the right order: it ...
0
votes
0answers
19 views

Woocommerce - Order categories and then pull products by that order

I will give an example what I am trying to make. I have 1 parent and 2 child categories - Sport > Football & Basketball. Also there are 2 custom taxonomy terms (Brands) - Nike & Adidas. Now, ...
2
votes
1answer
48 views

Display sorting options dropdown when using WooCommerce product category shortcode

I have a WordPress site, with WooCommerce. The WooCommerce archives pages as shop display a dropdown sorting filter like in this screenshot: Now in another page let's say example.com/foo On that ...
0
votes
0answers
29 views

Sorting in WP_List_Table class

I am using WP_List_Table class to create tables in Admin panel. I am trying to implement Sorting feature. I am using below code public function prepare_items() { $this->items = $this->...
0
votes
1answer
62 views

How to Sort by Date When Using d-m-Y Format

This question is pursuant to the following - How to Sort Custom Field Admin Column by Date I'm attempting to add functionality to sort a custom post admin list column by a date manually specified in ...
0
votes
2answers
60 views

How to Sort Custom Field Admin Column by Date

I have a WordPress website with a custom post type called 'Courses'. On the WordPress dashboard page listing each course I've added a new column displaying a custom field, which is a date, called '...
2
votes
1answer
29 views

Sort by two dates. Default entry date and custom field if present

I have a custom post type where there is an option to sort by date. There is however a custom date field that allows changing the display date. This custom date field is not always filled. Right now ...
1
vote
2answers
152 views

Sort in WP_Query(), not filter? Is it possible?

I want to query and SORT in WP_Query(). But whatever I do, it only prints posts with meta_key set up. But I want all the results and just sort them. This is my query: $query = new WP_Query(array( '...
0
votes
0answers
26 views

Display and Sort Tags by Last Word / Name

I have a page which lists all tags (artist names) for a certain category along with links to that artists work. Each post only has one tag if that helps simplify things. I am trying to order the tags ...
0
votes
1answer
23 views

Sort populated GravityForms list alphabetically [closed]

hope someone can help a newbie because I'm stumped on how to do this. I've got the following code in my functions.php that populates a GravityForms form "checkbox list" of products. The user selects ...
0
votes
0answers
7 views

Is there a way to execute a function whenever Gutenberg Blocks are rearranged?

i'm having the following problem: I have created a grid component which uses a binary packing script (packery by metafizzy) to fit its child blocks depending on their size. To improve the editing ...
0
votes
0answers
13 views

Is it possible to autosort tables in the visual editor?

A client asked if the tables in his Wordpress editor could be sorted alphabetically automatically. He asks because the tables are quite long and it would be easier for him to edit them this way. (I ...
0
votes
0answers
21 views

WooCommerce product sorting VERY slow

I have 2800 products in my WooCommerce store. Trying to use the All Products > "Sorting" utility in the backend to edit the desired order for them to appear is excruciatingly slow. Even if I filter ...
3
votes
3answers
169 views

Filter admin columns by custom post field value

I have a custom post type called dogs. Within the Add Dog interface, I have a radio-button group that gives choices for color, which are added to the new dog post as meta data. There are about five ...
1
vote
1answer
39 views

Admin multiple column sorting

This question seems simple enough, and I'm surprised that I don't find much while searching Google to find an answer. The only thing I've found is a pro plugin, so far. I'd just like to be able to ...
1
vote
1answer
33 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
1answer
20 views

Sort by promo code used woocommerce admin panel [closed]

I work on Woocommerce / Wordpress and I'm new, I want to custom my Woocommece orders list admin panel by adding the used coupons inside it, but I've got a little problem when i click on promo field ...
0
votes
1answer
35 views

how to develop a filter in wordpress to let the user filter the page content depends on the date (newest to oldest etc…)?

how to develop a filter in WordPress to let the user sort the page content depends on (alphabetically, newest to oldest and oldest to newest etc...)? I’d like another drop down tab on the left side ...
0
votes
0answers
32 views

Native admin table with search functionality: sorting by columns does not work

I display a WP_List_Table on a submenu_page and offer a search function, which works. However, if I sort by a column within a search result, all records are displayed again. I really don't know why ...
1
vote
0answers
34 views

How to sort by columns within a search result without displaying all rows again after sorting

I want to display a WP_List_Table on a submenu_page and offer a search function. The display of the data works so far and also the search, but the column sorting causes problems. If I click on the ...
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) ...
2
votes
1answer
33 views

How to sort posts with the first 2 or 3 by latest, and the rest is random?

I'm trying to sort my posts in the way I stated in the title. What's the simplest way to do this? I know how to change the order by object using the pre_get_post hook. But how can I use it to get ...
0
votes
0answers
56 views

WordPress Comments sort by custom meta key

I want to sort comments by a number of likes which is saved as a meta_key in the wp_commentmeta table: I have tried two ways but it doesn't sort the comments by most liked comment at the top. Please ...
2
votes
1answer
102 views

Sortable admin column for one meta key with three possible meta values

I've looked over 2 or 3 similar looking threads regarding sortable columns and the meta queries involved with making them work. None seem to resolve my exact problem. I am using the pre_get_posts ...
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
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). ...
1
vote
1answer
29 views

Custom post type, organized by categories

I know there are lots of questions and answers out there for this very thing, but I'm having a hard time putting it all together. The goal is to get a <ul> with category names as the <li>, ...
0
votes
0answers
53 views

How to sort wordpress posts by distance and date

I want to sort wordpress posts by user's distance from posts location and by date by using some calculation..Here is the formula. 2*log(distance) - log(time in seconds) I saved post's latitude and ...
0
votes
0answers
34 views

How to use multiple orderby conditions on query search results? (orderby one post type, relevance)

I have a need to sort the search results so that a custom post type "authors" is always at the top, followed by all other post types sorted by relevance. I've found numerous examples about altering ...
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
283 views

woocommerce product sorting based on custom fields

I am trying to add a custom sorting option for woo commerce . So I am using following code to add new sort option plus set it as default meta key is '_am_cat_sort' function ...
0
votes
2answers
31 views

Sorting post by custom field and category

I want to sort posts by a meta value in a custom field. Basically I've added a field called 'date_event' and want to sort the posts by that date (stored as YYYYMMMDD). The only working example I have ...
0
votes
1answer
89 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
2answers
72 views

Case insensitive ORDERBY in wpquery

I'm trying to sort custom posts in alphabetical order, and I've just now realized that capital letters are being sorted before lowercase. Two restaurants start with 'Cal' and 'CAT' with 'CAT' being ...
0
votes
2answers
202 views

Woocommerce Category Sort Dropdown

In Woocommerce Category page default sort dropdown has like below options. My question is what/how products sort by Popularity ? Not a code What is the measurement ? like if sort Price: Low to High,...
0
votes
1answer
209 views

Sort by last word in title

I need to order posts within a category alphabetically based on the last word in the title. I have seen a few suggestions online but none fit correctly. I am using a custom layout for the category ...
0
votes
0answers
59 views

Sort posts on custom field AND after that sort on date?

I'm having trouble to understand customizing the new WP_query. I've found the script below, partly, here in order to get the sticky posts. I've further edited it in order to: first get the (sticky) ...
0
votes
2answers
111 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
1answer
23 views

How to mix two orderby-parameters into one ordered result

I'm trying to figure out how to get an alphabetically ordered list of posts using two different orderby parameters. Im filtering the archive query something like this: function ...
0
votes
0answers
19 views

Custom Sort Order for looping through Taxonomy

I'm looping through all categories for a custom post type. What I'm trying to do is manually set the order for the loop by taxonomy id: My current format is: $categories = get_terms( '...
1
vote
1answer
204 views

WooCommerce sort products by the actual product width(not the shipping width)

I have regular/simple products and products with variance in the database. Regular products and variations have a product width(_pm_width_inches) associated with them . I am trying to sort based the ...
4
votes
4answers
2k views

WordPress post sorting with AJAX

I am having a search result page for custom post type. I want to have a ajax sorting feature. Eg sort the post by taxonomy without reloading the page. A very basic example will help. Thanks The ...
0
votes
0answers
252 views

Custom sort by menu_order not working when set as Default product sorting

I have products with Gallons as size so I want to list products in ascending order by Gallon size so I added numeric gallon values to the menu_order attribute field. After adding the below code to the ...
0
votes
2answers
1k views

how to get post order by post id wp_query?

i have 4 post and i displaying 2 post per page. $ids = array('16085','16088','16083','16091'); $options = array( 'post_type' => $post_type, 'posts_per_page' => $posts_per_page, ...
0
votes
1answer
314 views

Multiple sorting criteries (order by)

I want my products to be sorted by price (ascending) and products, which are out of stock be placed at the end of the products list. How can I achive this in WooCommerce? Is it ever possible to ...
0
votes
1answer
120 views

change order of images attached to post

Im not quite sure how to explain my issue so let me know if Im unclear about anything. I have on my front-end post form a multiple file upload input that uploads files to my specified folder and ...