Questions tagged [sort]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
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
124 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 $...
0
votes
1answer
3k views

How to use a dropdown to filter posts by custom field

I have a custom field (not using ACF) attached to all my posts (standard WP posts) called 'Read Time'. Basically a function calculates the read time of each post and enters a number into that field. ...
0
votes
1answer
46 views

Ajaxify Post Sort

I have some code here that when you click on certain links it reloads the page and sorts my posts based on the query array that I have set. I am just wondering how do I make it load and sort by ajax ...
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 ...
0
votes
1answer
236 views

Sort an array with an ACF meta key

I get an Array from wordpress get_categories and i need to sort it with a value that is inside an ACF field. This value is composed like this : number | year , for example 2 | 2017 I need to sort ...
0
votes
1answer
797 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 ...
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
1answer
481 views

Group Post by Custom Taxonomy 2 under Custom Taxonomy 1

I have created two custom taxonomies (1. Business location and 2. Business Category) for a custom post type (Business Listing). Now I have listed all the location under Location taxonomy archive where ...
2
votes
1answer
122 views

How to sort posts in admin by titles with dd.mm.yyyy format?

I have created a Custom Post Type for Booking, new posts are inserted by visitors and the title is formatted as date on which the booking takes place. So, the post list in admin looks like this: Is ...
0
votes
1answer
746 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 ...
2
votes
1answer
54 views

How to re-order pages en-masse

The site I'm working on has a few thousand pages, each of which is an address listing. I need them sorted by a) street name, and b) address number. I can go through each individually and change the ...
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 ...
0
votes
1answer
21 views

Function to alphabetically sort custom post types creating duplicates

I have a function that creates a list of custom post types and sorts them alphabetically. It also takes the first letter of those posts and shows it as a header. For some reason, at some point it ...
0
votes
1answer
1k views

Display all posts in a custom post type, grouped by a custom taxonomy. How to sort the posts alphabetically and the terms by ID?

I have a custom post type called as books with taxonomy named as genre. Inside the genre there are a number of terms such as horror, romance,comedy`, etc. I want to display them in the archive page, ...
3
votes
2answers
718 views

How to Group Posts by the First Letter or Number?

how to create the logic that makes those posts sortable either by the first letter of title or numbers? I want when I click on a "letter" the posts must get updated with the given first letter I want ...
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
5k views

Orderby Post Views

I want to make a filter list for my posts (in homepage, search page and archive page) Here is an example of what i'm looking for Sort by: - Date (/?orderby=date) - Random (/?orderby=rand) - Views (...
0
votes
1answer
312 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? ...
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: $...
0
votes
1answer
795 views

Sort a custom post with ACF: Date Picker & Display Featured!

Hello I have a custom post type event and i have two custom fields: event_date event_type I want to display all my events which has event_type = Featured and sorting should be by event_date in DESC ...
6
votes
2answers
536 views

Sorting search results by taxonomy terms

I'm writing a plugin that makes searches work only on a particular custom post type and it sorts the results according to the taxonomies the user selects in its backend configuration. The admin can ...
1
vote
1answer
83 views

Nesting if statements to echo only one string based on what tag was filtered?

The goal is that when you are on our /upcoming-events page you can then filter by type of event or region. After you select the option from the dropdown, I want to echo in that page title into the ...
0
votes
1answer
72 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( ...
1
vote
1answer
319 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'...
2
votes
1answer
92 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 ...
0
votes
1answer
662 views

How to sort custom post's category by id from the theme's function, without using a plugin?

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
1answer
34 views

Array sorting assistance

I have the following array that I want to sort, how would I approach this as it only has one key / column? Short brief: I have movies that are saved in a custom post type. some have time allocated ...
0
votes
1answer
36 views

How use custom upload directories in filesystem and url based on media type or category

How can i choose when uploading a file or more where i want the file to go? Like i have 6 brochures and i want they go to wp-content/upload/brochures/ Other example is i have 20 images which 10 will ...
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 ...
0
votes
1answer
149 views

Pin to Top Functionality using orderby custom field then event date

I need to accomplish the following: pull CPT tribe_events sort by custom field "pin_to_top" in DESC order get posts from today's date & any in the future sort remaining posts in ASC order My ...
0
votes
1answer
86 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
1answer
286 views

Group/list/sort custom post type posts by date in tabs from acf datepicker field

im working with foundation tabs and i want to sort my custom posts by YEAR from datepicker field. Each tab is a year (2016 2015 etc). When users click on the tab and displays is, all the custom posts ...
0
votes
0answers
33 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 ...
0
votes
1answer
29 views

Display three sequential posts on each page load, without repeating previous

I am using a custom post type to manage adverts on a website. There are 3 identical ad spaces on each page, output via WP Query. Could someone please suggest, on a high level, an approach to show 3 ...
0
votes
1answer
28 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, ...
3
votes
2answers
850 views

How to sort a table of custom posts by column containing custom field

I have a custom post type called laptop with custom fields such as CPU, OS, RAM etc. creatied using the Advanced Custom Fields plugin. I'm displaying a table of laptops, where the table header is a ...
0
votes
1answer
220 views

Group & Sort Taxonomy terms by letter - Is there a better way?

Background: I'm working on a gaming blog, and I've created a custom taxonomy for Games. I've added a Game List page which will (unsurprisingly) list all the non-empty terms within that taxonomy. ...
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'...
0
votes
1answer
643 views

get_terms sort order with child categories of varying depth

I'm using get_terms() to search through WP categories. I'm trying to order them all by name. The code below doesn't work, apparently because there are multiple levels of child categories involved. How ...
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 ...
0
votes
1answer
398 views

How to tag the main tag? [closed]

I have code displaying related posts (to the selected post in the single.php file) based on tags. Posts displayed are those with the same tags as the single post, the selected one. I realize that ...
0
votes
0answers
378 views

Combine WP_Query with array of custom data to single loop without breaking the pagination

Content of my loop should not be just posts. Other sources of data should be seamlessly included to it - such as newly updated terms of custom taxonomies, tweets pulled by an API or new Instagram ...
0
votes
1answer
245 views

How do I sort this custom list of sticky posts

Here is my code, which gets me all the sticky posts in my site. $sticky = get_option( 'sticky_posts' ); $args = array( 'posts_per_page' => -1, 'post__in' => $sticky, '...
0
votes
1answer
595 views

Wrap group of wp query posts to parent div by date/year

I have wp query for posts. I'm ordering them by custom field "event_date". (The field format example is 09.08.2016). I'm extracting year and month from each post and adding it as div class, however i ...
1
vote
1answer
868 views

Sort entries by date mixing two post types

I'm trying to build a wp_query for two post types (post and product. The second is a woocommerce custom post type). The goal is to get a list of posts sorted by date. Something like this: - Post 3. ...
1
vote
1answer
281 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=...
0
votes
1answer
144 views

Best way to sort posts with different types by distance

I'm working on a project that I need to We have x posts, 1 Sponsored (custom meta field), unlimited paid, unlimited free posts (these are types of posts) We need to show 1 sponsored at top, ...

1 2
3
4 5
10