Questions tagged [sort]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
0answers
5 views

How do you create a series of buttons to filter by category tags?

I am making a website to sort classes The structure I currently opted for was to have pages that correspond to the discipline - e.g. Computer Science The post would be the course e.g. Introduction ...
0
votes
0answers
10 views

Alphabetical taxonomies and pre_get_posts not working

I am currently building a website that makes use of a theme. The theme has a custom taxonomy called team_group. I created a custom template called taxonomy-team_group.php to be able to list the posts ...
0
votes
1answer
14 views

Drop down filter sort posts by latest, last 7 days and monthly

I am trying to use a drop down for users to select and show posts made latest, last 7 days and monthly. Currently I was able to find code to just sort by date in ASC and DESC order. <div id="...
0
votes
0answers
15 views

Sort products by category name

I would like to sort my catalogue by category name. Some of my products have the category "top" that I would like to be displayed at the beginning of the catalogue. There's also already a sort by date ...
0
votes
0answers
4 views

Sort wp_query by variable created inside the loop

I have a custom loop that pulls all the child pages of the current page, and displays them. However, I need to order this query by the $first_row_image variable that is created inside the loop. This ...
-2
votes
2answers
25 views

have_posts order by title descending

I have custom post type 'movies' listing which i want to order by title, descending. Currently it sorts by post id. The code is: <?php if( $movies->have_posts() ) : ...
0
votes
0answers
10 views

Is there a way display only certain blocks depending on user selection?

I have a long page, with a lot of blocks showing different resources for different cities. I would like to categorize them, so that a user can see only the resources that apply to them. At the top of ...
1
vote
0answers
38 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
33 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
0answers
62 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
1answer
22 views

Listing Cities A custom taxonmy by selection order

I have below code that lists cities in ascending order, I want to lists cities based on the order I select the cities from the frontend. It is a shortcode created by theme. Cities is a custom taxonomy ...
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
15 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
26 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
27 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
1answer
21 views

Sort custom post type by most current date picker

I'm trying to sort custom post type made with ACF plugin by most current date. Ideally future most current post should be first. Currently, I'm sorting by date, which gives me the earliest post as the ...
0
votes
1answer
51 views

Move some posts to end of sort order, even if there is a sort in the wp_Query already

I have a site that lists properties for sale. I have a custom wp_query, with a sort dropdown I created. This dropdown reorders the posts query by date, price (low-high & high-low) and beds (low-...
0
votes
1answer
46 views

replace text in Sort Box

I have renamed the woocommerce sort options to remove the default "Sort by" preceding all of them. However I would like to rename the text in the box at the top to “Sort by", so that the selected ...
0
votes
1answer
82 views

Rename WooCommerce sorting dropdown options [closed]

How to rename the WooCommerce sorting dropdown options and customise the wording? For example, change "Popularity" to "Best Selling" or "Price: Low to High" to just "Price Low to High" without the ...
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
29 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: $...
1
vote
1answer
44 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
1answer
53 views

Custom post type order by post_title

I got a custom post type called "employees" and this is the query I use with FacetWP (plugin we are using). We want to sort the employees by post_title. <?php return [ "post_type" => [ "...
0
votes
0answers
9 views

Sort query by title in meta value stored as id

How can I sort a query alphabetically by meta value where the meta value has the id of a related post and not its title? I have two custom post types: news and companies. Each post under news has a ...
0
votes
1answer
52 views

How to Sort Products by “Featured” first?

I would like the default sort method of my product archives to display all the featured products first, and then display all the other products as normal. I'm not sure if there is a hook for this or ...
0
votes
0answers
17 views

Ordering search results from a custom post type by name match first (ie. the way order by relevance works for standard WP)?

The DirectoryBox theme by ChimpGroup has a heavily customized search function that searches its own custom post type, 'listings'. Search results are returned in seemingly random order when I specify ...
0
votes
1answer
17 views

How to sort post category using its Description

I Am trying to sort my custom post categories according to its description. I tried below args but it did not work $taxonomies = array( 'post_tag', 'product-type', ); // Add the slugs of ...
0
votes
0answers
19 views

How to make 2 separate pages have 2 separate sorting default options

I currently have my site on a custom default sort with WooCommerce. I need one page to have a different default sort without changing the other. I want this solo page to be sorted by average rating. ...
1
vote
1answer
51 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
1answer
57 views

Order wordpress taxonomy parent terms by their children count

I need to order parent terms by their children count: function sort_terms_by_children_count ( $terms ) { $sort_terms_by_children_count = array(); foreach($terms as $term) { $count = ...
0
votes
0answers
25 views

Sort posts numerically by converted date format

Updated for clarity: I need to convert the post date format from Y-m-d to mdY and sort by mdY numerically, not by the actual timestamp. My goal is to order the posts by month first, then day, then ...
0
votes
0answers
108 views

Showing and Sorting WooCommerce 'Last Order Date' on Users screen

Need to show and sort the 'last order' date from WooCommerce on the Users screen. I was able to get the date to show correctly, but when I go to sort, Wordpress does not show all the users. The site ...
0
votes
0answers
9 views

Bulk Redirect of posts

Im really hoping you can help me. We need to redirect a lot of posts and from what I've read, using the redirection plugin, to add the old link to the new target. But - I need to redirect only the ...
0
votes
1answer
108 views

Orderby event date (if it exists) or post date (if it doesn't) - how to reorder posts based on meta value OR date

I need a way to sort the posts on my tag and category archives according to the event date (if it exists) OR post date (if it doesn't). I have a combined archive for events and posts, but want to ...
0
votes
1answer
62 views

Order by value of Custom Field using url string

I have a simple dropdown: <select class="dropdown-class" name="sort-posts" id="sortbox" onchange="document.location.search=this.options[this.selectedIndex].value;"> <option disabled ...
0
votes
1answer
38 views

ACF pro: Group teaser by datepicker year and display custom sub fields [closed]

I want to group my custom post types into years. I should look like 2019 Post 1 Post 2 Post 3 2018 Post 1 Post 2 2015 Post 1 YEAR Post 1..n Following this example here: Order and group posts by ...
0
votes
0answers
14 views

Custom shortcode sorted by meta date shows only current year and displays other language in date

I have this snippet in my functions.php. I thought it worked, but I noticed that it shows events only from this year (I have more events that are next year) and also, I can't get the date format to ...
0
votes
0answers
22 views

Wordpress - Products without price go to the bottom when sorting by price ASC

I have a built-in filter in my WooCommerce for ordering my products by price. When I choose to order them by price ascending, the products without price comes all the way to the top. I want these ...
0
votes
0answers
32 views

How to Sort Categories by Parent-Child relationship and not by Alphabetical Order?

I have created a category "Videos". "Videos" as parent category, I have created 2 categories "Teasers" and "Trailers". "Teasers" as parent category, I have created Subcategories "English", "Hindi" ...
0
votes
2answers
88 views

Post filtering is returning blank page

I embedded some code to generate post filters referencing an article at https://premium.wpmudev.org/blog/add-post-filters/ as displayed below: <form class='post-filters'> <select name="...
0
votes
0answers
87 views

sort posts on front end using url query

I am trying to sort posts on my archive page based off a custom field. The custom field is a number. I have the following in my functions.php file - function wpse139657_orderby(){ if( isset($_GET[...
1
vote
0answers
27 views

Store CPT 'Reviews' average ratings to a WordPress DB table or to a DB custom table?

I am working on this portal in which users can review the services (with description and rating) of a cultural place. BASICALLY, I created two Custom Post Types (CPT) with Pods, one is ...
1
vote
0answers
44 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 (...
0
votes
0answers
328 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
13 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
15 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
39 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, '...
2
votes
2answers
2k 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
66 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
289 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 ...

1
2 3 4 5
11