Questions tagged [sort]

The tag has no usage guidance.

155 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
4
votes
0answers
670 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)...
4
votes
1answer
3k 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 (...
4
votes
1answer
322 views

How to sort posts by last name (2nd word) on ONE category only?

I have an "author" category that is used as a list to browse multiple posts containing author biographies. I have Smart Category Ordering installed and right now it is sorted by title ascending. ...
2
votes
0answers
522 views

Custom column sorting in WordPress admin post table

I have made a custom column in user administration panel showing user meta data and registered it as sortable. Made a query action to sort it by the meta numerical value (the stored user meta data is ...
2
votes
0answers
202 views

Custom taxonomy list and sortby letter pagination problem

I'm getting a taxonomy list page with pagination using this code : <?php $sortby = $_GET['sortby']; if(isset($_GET['showall'])): $args = array('hide_empty' => 0); else: $page = (get_query_var('...
2
votes
1answer
90 views

Filter Posts by Excluding Categories

I am logged on as admin I am on the Posts dashboard I have Posts assigned to multiple Categories and I have posts that are assigned to only one category. I want to display posts that are assigned ...
2
votes
0answers
266 views

Frontend sorting

Here is what I am trying to accomplish: Which partly works already, I can sort with 2 dropdowns and have a pagination. I have to merge both dropdowns into one, and add "posts per page" without ...
2
votes
0answers
74 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 ...
2
votes
1answer
45 views

wordpress custom_meta ordering of timestamps

So I have a wp meta query that is handling the searching of events which have a start timestamp, and an end timestamp, I want to return all results within the two dates a user picks in the search. ...
2
votes
0answers
2k views

query_posts with a custom post type, a meta_query and sorting by post date?

I've searched the archives and found questions similar to what I need, but haven't found exactly what I want. I've got a bunch of products that are sorted by a meta_key of country, and I'd like to be ...
1
vote
0answers
24 views

WP_Query: Group events by year, sorted DESC; then by date for each year group, sorted ASC

I'm trying to set up a query for an "event" custom post type that groups posts by year, with a heading for each year, in descending order; then, for each year group, ordered by date in ascending order ...
1
vote
1answer
27 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 ...
1
vote
1answer
31 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 ...
1
vote
1answer
50 views

Advanced search by two criteria - sort by location and date (ascending or descending)

I have spent a couple of days working on this and I am still not able to figure it out. I am trying to make advanced search filter that sorts posts from a specific category on two criteria: location (...
1
vote
0answers
42 views

Taxonomy list : how to order by count percentage of custom post type

I have a taxonomy list. and taxonomy have two custom post types. I want to order taxonomy according to this result. Lets say : A = count of my A custom post type B = count my B custom post type (...
1
vote
1answer
342 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 = (...
1
vote
0answers
41 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 ...
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 ...
1
vote
1answer
268 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 ...
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="...
1
vote
0answers
40 views

Column Sorting Code on users.php

I have added some custom code to my functions.php to add column sorting for several of my custom meta fields. I have encountering two issues. 1. For some reason when I add this code all of the data ...
1
vote
0answers
750 views

Sort and filter custom post type posts by custom taxonomy

I have a question as a beginner in wordpress. So for my little knowledge in coding i came to a point where i don't know the way out. I have looked through whole SE, but it seems no other thread fits ...
1
vote
0answers
4k views

Sort & Display WooCommerce Product Attributes by Order

I'm attempting to display some WooCommerce attributes on a page based on their menu order using get_the_terms and cannot get it to work. Originally, I used this code and it worked fine: $...
1
vote
1answer
317 views

How to sort posts inside categories

A weird question from my friend - is it possible in WordPress to sort posts inside categories? Right now the sort order is the default. He shows on specific pages posts from different categories. That'...
1
vote
0answers
34 views

Wordpress posts page for customer filtering and sorting along with category filter

I've been struggling to implement WordPress posts (events) list page with the following functionality - Category filtering - Past event or Future event or Current event - Sort by event start date or ...
1
vote
0answers
176 views

Change the sort order for posts to include custom field

I want to change the sort order for all my posts. First by a custom field 'event_begin' which has a value like this:, and then by the regular post date. The regular posts do not have the custom ...
1
vote
1answer
280 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=...
1
vote
1answer
406 views

Order a custom post type admin screen by a second custom post type title

I have two custom post types: Products and Brands. The Product slug is 'eproduct'. The Brand slug is 'brand-listing'. On the Product admin page, I have added a custom column that lists the Brand ...
1
vote
0answers
201 views

Sort custom post type by multiple custom fields

I have 4 text fields in a custom post type. How can I sort the posts by this order of text fields: brand_fbn - model_fbn - year_fbn - plate_number? This is my code, which isn't working: $ins = new ...
1
vote
0answers
104 views

Best Practices for a Completely Customizable Homepage - without plugins

Let's say you have a homepage where you want to be able to feature 10 posts of various types (posts, pages, and Custom Post Types). You have hundreds of these posts to choose from. What would be the ...
1
vote
0answers
681 views

Sort alphabetically by custom field

I'm trying to change the sort order of a custom field in a custom post type. I want it to be be alphabetical by the 'location' name. It's sorting by location, but not keeping them in alphabetical ...
1
vote
1answer
665 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
2answers
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 ...
1
vote
1answer
161 views

How to sort a custom wordpress query by combination of meta values?

I'm trying to build a custom query that's a combination of custom key values. For example, with the code below I'm able to sort my posts by how much money they've received (paidusd) and how much tips ...
1
vote
0answers
176 views

Sort results by groups of numbers and letters

I have this code: <?php $letter=' '; query_posts( array ( 'orderby' => 'title', 'order' => 'ASC' ) ); if ( have_posts() ) : while ( have_posts() ) : the_post(); ?> <ul> <?...
1
vote
0answers
658 views

Custom taxonomy/category order

My products are sort by menu_order, but I would like to sort category name too. I tried a few plugins and all doesn't works. Code, which display category name and products list: <?php $...
1
vote
0answers
487 views

Custom Sortable Meta Boxes

I've looked all over and can't seem to find what I'm looking for (probably because I don't even know the terminology for what I need to do). I need to make some custom meta boxes that are similar to ...
1
vote
1answer
191 views

Gallery shortcode numerical sorting

When I try to sort a Gallery created through the [gallery] shortcode by numerical titles I get them sorted in alphabetical order. That means that they are sorted like so: 1, 3, 34, 4, 56, 6, etc. ...
1
vote
2answers
338 views

Sort by site/blog column in Multisite

I use WordPress Multisite and made a plugin that adds columns with some data. My code is based on this WP Engineer article. The key function in WordPress Multisite is manage_sites_custom_column. And ...
1
vote
1answer
477 views

Sort by page information by Ascending Numbers

Basically I have a problem that I have details being pulled from advanced custom fields and I currently have them ordered by page title in ascending order. However, instead of ordering them Ascending ...
1
vote
2answers
3k 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'...
1
vote
1answer
237 views

WP Group posts by year(desc) > month(desc) > date(asc)

I have a custom category template to group posts by a custom field 'event_date'. 2 things I cannot figure out, correctly: grouping by year and month, and having those in descending order, while the ...
0
votes
0answers
35 views

Get authors list and sort them by recent posts

I have a authors list and its sorted in the alphabetical order. The query for it is here $user_args = array( 'orderby' => 'display_name', 'order' => 'ASC', array( 'who' => '...
0
votes
0answers
13 views

Listing Cities based on total user registered

I have this code that lists cities in assending order, I want it that it lists cities based on the total number of listings/users "$total_users = listingo_get_total_users_under_taxanomy($city_name,...
0
votes
0answers
13 views

wp-admin: retain category hierarchial structure when sorting

By default, the category page in the admin backend sorts categories in alphabetical order preserving the parent->child hierarchy. When sorting categories e.g. by count the hierarchy is lost. All ...
0
votes
0answers
14 views

How to sort by a custom “text” date field in mmddyyyy format

I'm having issues sorting by a custom date field on my WordPress website. I'm not a WordPress coder by any means, and i'm working with a previous owner's code. Basically the field is an ACF text ...
0
votes
0answers
21 views

tax_query and sort by meta_key - no results

I have query: $tax_query = array( 'relation' => 'AND'); $tax_query[] = array( 'taxonomy' => 'kategoria', 'field' => 'id', 'terms' => $term->...
0
votes
1answer
26 views

Sort custom post type by custom datepicker instead of filtering

I have a custom post type Event that I use in conjunction with ACF. I have a group called event and inside that group I have a field called date_start. And this is the code that I currently have, but ...
0
votes
0answers
41 views

How to sort by multiple values in a nested WP_Query

I am displaying courses, enrollment, along with rooms whose capacities are greater than or equal to the enrollment. This query works, except the 'order' => 'DESC' for courses, and 'orderby' => '...
0
votes
0answers
24 views

How to get ordered fields from repeateble fields group added via Toolset wordpress plugin?

I got 2 fields in group ordered by toolset-post-sortorder meta_key: youtube_id: TeBW-WByzlw 144 163 youtube_id: CEdYPEKDD2E 255 270 This it how it look in DB: This is how I try to get fields: $...