Questions tagged [sort]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
-1
votes
1answer
41 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
92 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 ...
1
vote
0answers
39 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
41 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
138 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
135 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
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
0answers
48 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
34 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
48 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
1answer
620 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
65 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
260 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
171 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
312 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
409 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
111 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
147 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
25 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 ...
1
vote
1answer
262 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
3k 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
2answers
3k 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
419 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
136 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 ...
0
votes
1answer
25 views

sort items by randomness

I have an e-commerce shop. I am new to php and wordpress. (I have a python and ruby background though, I just don't know php) And I have a page with items. Right now the last 20 items are displayed ...
0
votes
0answers
188 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 ...
0
votes
0answers
105 views

How to sort custom posts including null meta-values ​in admin columns with meta_query?

SQL REQUEST SELECT post.ID, month.meta_value, year.meta_value FROM wp_posts post LEFT OUTER JOIN wp_postmeta month ON month.post_id= post.ID AND month.meta_key='mcv_end_month' LEFT OUTER JOIN ...
0
votes
1answer
115 views

Using Orderby and meta_value to order natural/alphanumerical

I added a custom column for a custom post type. Then I put it to be the 3th column, and now I want to sort it alphanumerical. I use this action : add_action( 'pre_get_posts', '...
0
votes
0answers
38 views

How to order blog posts by no. of likes?

I am using a plugin called Kodex likes and it has a counter for how many likes a blog post got. If I add sorting parameters to the URL using the ones already built in Wordpress like: www.website.com/...
1
vote
0answers
55 views

WP Query sort by meta value

I would like to get posts order by timestamps. I have to following code but the query keeps getting posts order by modification dates and not with the "evcal_srow" meta. Any clue? <ul class="...
4
votes
1answer
239 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
1answer
2k views

Custom post type sorting: alphabetical order

I want to display my custom post type "portfolio" in alphabetical order and I got it working fine with this code: add_filter("posts_orderby", "my_orderby_filter", 10, 2); function my_orderby_filter($...
0
votes
1answer
2k views

Sorting search results with custom dropdown

I have the following select dropdown code for sorting on my search results page (search.php) that works for custom fields. <div id="sortby"> SORT BY: &nbsp; <select class="dropdown-...
0
votes
1answer
22 views

Sort posts by clicks on download button

In my website each post has a download button for a certain asset. I want to be able to sort my posts by how many times an asset has been downloaded (or, in other words, how many times the download ...
0
votes
1answer
25 views

sorting in wp query based on custom field value

I am trying to get posts of custom post type 'job_listing' on bases of two custom fields i.e 1) _job_location 2) _company_name this is working fine but I also want to display the posts first that ...
0
votes
1answer
837 views

Order woocommerce products alphabetically by second word in title?

My site actually has people's names as product titles and I really need it to sort alphabetically by the second name (surname) I think I've found solutions to enable this with default WP post titles ...
4
votes
2answers
5k views

Make custom column sortable

I have added custom column to a custom post type, and it works fine. I just want it to sore the names by title so tried this, function sortable_custom_columns( $columns ) { $columns['...
0
votes
2answers
870 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:...
0
votes
0answers
32 views

week days sorting based on starting day

I have a taxonomy with weekdays. I want them sorted based on basis of starting day opted by the user. Basically, I am working on Timetable and different regions have different starting day of week. ...
0
votes
1answer
664 views

inner foreach loop sorting

I have the following script and i need to sort the inner foreach loop alphabetically but with no success. $args = array( 'post_type' => 'clinical_sites', 'tax_query' => array( ...
1
vote
1answer
112 views

list posts and wrap them alphabetically A-Z

0 down vote favorite I have a list of posts on my website, what I'm trying to do is to wrap them alphabetically from A-Z by title to get a glossary like this : A. Apple B. Banana C. Carotts D. E....
0
votes
1answer
42 views

How to manage a music library in wordpress

I need to make a music library which will primarily be sorted by artists. I'll need a database to hold all the music titles, artist, genre etc. I'll need some sort of backend language to manage the ...
0
votes
1answer
58 views

Sorting Posts by Taxonomy thats not within the query's $args

I’m displaying posts currently using the WP_Query, which doesn’t include the state taxonomy within the $args because I do not want the state to be within the query. But I do want to display the state. ...
1
vote
4answers
3k 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=...
0
votes
1answer
51 views

Order BY Most Liked And Published Between Previous Week Monday And Next Week Monday

I have a code which sorts the content by most liked, but I would like it to show the most liked in between previous week monday and next week monday. And the posts must be published in that time frame....
0
votes
1answer
2k views

Sorting products by price ( regular + sale price )

I'm using WooCommerce and I'm trying to filter my products by price. My problem is that the meta_key is only taking into account the regular price and not the sale price. As a result if a product is ...
0
votes
1answer
116 views

Creating a “glossary” of WordPress posts of a specific post type

Alright, so here's what I'd like to do. I'm wanting to create a "glossary" using WordPress posts of a specific post type. In other words, the "title" and description" of each glossary entry would be ...
0
votes
1answer
54 views

category & sub category order issues in wordpress

I have Two parent category on my website, and each of those category have children category, like this : constructions corollaires 01 02 03 04 Between two suns I II III ...
0
votes
1answer
27 views

get the headlines of the authors' last post

I want to list my authors with the title of their last post. ı want to sample sort user1, title1, date=19.10.2017 > user2, title2, date=17.10.2017 > user3, title3, date=15.10.2017 <?php global $...

1 2 3 4 5 10