0
votes
0answers
14 views

Sort CPT by first letter of a meta field in a specific range

'I'm working on a way to display member profiles (Custom post type) sorted by the first letter of their last name in a given range. For example all members with a last name starting with 'A' up to ...
0
votes
0answers
44 views

Advanced wp_query - custom date and postname

I'm trying to write a query and sort by: custom date postname (in reverse order) because my postnames have a version string at the end and the latest entry should stay on the top of each other. ...
0
votes
2answers
41 views

How to orderby meta_value_num with dollar ($) sign

The custom fields all have prices including $ signs, and a dot as separator. $theQuery = new WP_Query(array( 'orderby' => 'meta_value_num', 'meta_key' => 'price', 'order' => ASC )); All ...
0
votes
0answers
37 views

Sorting meta_value as integer doesn't work

This plugin uses the below chunk of code to print the top 10 highscores. But this doesn't get the list of top 10 scores sorted by meta_value in my WP install $scoreboard = new WP_User_Query( array( ...
2
votes
1answer
69 views

How to make orderby 'meta_value_num' OPTIONAL?

$args = array( 'cat' => 5, 'posts_per_page' => 8, 'meta_key' => 'custom_sort_order', 'order' => 'ASC', 'orderby' => 'meta_value_num' ...
0
votes
0answers
44 views

Query category-specific, paginated posts and allow viewer to change sort order

Maybe this has already been asked here, but I can't seem to find a solution, so forgive me if this is a duplicate. I have coded a custom template to display all posts from a category with the ID 36. ...
-5
votes
1answer
48 views

custom sort posts in archive/taxanomy page

I want to override the default sort order of posts in archive and taxonomy pages. what hooks should I implement?
0
votes
1answer
32 views

I am having problem sorting custom post type using WP_Query

I have a custom post type called personnel Look at this code: $args = array( 'post_type' => 'personnel', 'posts_per_page' => -1, ); $personnel_query = new ...
0
votes
0answers
36 views

query_posts with sorting on a custom datestamp

I have a custom meta field that I want to use to sort with query_posts but its not ordering my posts properly since it is a datestamp (i.e. 04/21/2014) and its treating it like a normal text string. ...
1
vote
1answer
51 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 ...
0
votes
1answer
47 views

How do I sort post listing by child post count?

I have two custom post types called questions and answers. The questions list includes a custom column which displays a count of the answers for each question. I need to be able to sort the listing ...
1
vote
3answers
1k views

Query to sort a list by meta key first (if it exists), and show remaining posts without meta key ordered by title

I'm working on a custom taxonomy term page template where we want the items that are connected to the term sorted by a publication date (custom date field) - and if there are multiple items on the ...
0
votes
2answers
420 views

Sort posts by category name and title

Trying to figure out how I can output my posts based on category title (a–z) and secondly, the title of the posts within the category: A CATEGORY – A post beginning with a – Because I want to be ...
0
votes
0answers
83 views

Columnizing custom post type based on custom taxonomy

my first question here, so I'll try to be thorough. I have page on which I'm trying to sort a custom post type with around 350 different artists by a custom taxonomy. The custom taxonomy is basically ...
0
votes
1answer
62 views

Sort Posts with custom meta key by default which is currently set as optional

I'm new to Wordpress so please bear with me. Please check this link The posts are currently sorted by date. But if you mouse over on Latest Articles you see there are other options for sorting like ...
2
votes
2answers
780 views

Sorting: custom query with orderby meta_value_num THEN by title

i try to run a custom post type query to match following criteria: sort movies first by year in descending order, after that ("inside" the year order) by title alphabetically. desired output: ...
1
vote
1answer
7k views

Woocommerce custom loop to show all the products

I'm currently working on an e-commerce website and I met an problem. My client want a page e-boutique with all the product categories displayed, followed by 3 promoted products and a button "show ...
0
votes
1answer
221 views

Exclude posts with specific meta_value while sorting by a separate meta_value

I am trying to exclude posts with a specific meta_value with a specific meta_key while also sorting the posts by a meta_value with a different meta_key. This is my current code for the WP_Query ...
1
vote
2answers
790 views

Wp_query: sort by PHP variable

Here is my problem: For my articles, I use a custom post type "exhibitions" and posts for all other news. I am displaying them in one query ['post_type' = array('exhibitions','posts')]. The orderby ...
1
vote
1answer
131 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. ...
0
votes
1answer
384 views

WP_Query posts by distance based on LAT & LNG in Database

I've got table in the WordPress database that has lat & lng stored and I'd like to add a sort feature on the results page 'Sort by Distance' that gets the locations that are closer to your ...
0
votes
1answer
584 views

how can i change WP main archives loop to sort by name or title

I've got the following code which i found somewhere else i use it for pagination. I don't understand all of it although I've read codex.wordpress.org/Class_Reference/WP_Query several times. they ...
2
votes
4answers
7k views

How to get Page/Post Gallery attachment images in order they are set in backend using WP_Query()?

I am trying to retrieve all the images from the Gallery of a page in the order they are set in the backend. So far I have: $my_wp_query = new WP_Query(); $all_wp_pages = $my_wp_query->query( ...
1
vote
1answer
232 views

Crafting WP_Query array, sort by date

question about wordpress WP_Query: 'post_type' => 'event_date' outputs dd/mm/yy ex: 31122012 I would like to order my frontend 'event_date' output not by latest WP post entry but by latest ...
0
votes
2answers
644 views

Select custom posts by meta_value and sort by a different meta value

I have my query set up like this: $article_query = new WP_Query(array( 'meta_key' => 'issue', 'meta_value' => $post->ID , 'post_type' => ...
0
votes
1answer
415 views

WP_Query -> sort results by relevance (= most tags / taxonomy terms in common)

I'm trying to write a new "related posts" widget (for the single post view) for my custom post type, filtering by custom taxonomy terms that the related posts should have in common with the current ...
0
votes
2answers
485 views

How to sort queried pages by an array of page ids?

I'm creating a one page wordpress website, and I need my 'home', 'about', 'portfolio', 'services' and 'contact' pages to all be on my front page. I created the following page template for my front ...
1
vote
2answers
154 views

How do I sort posts with multiple pages

I am using a drop-down to sort posts by title, meta_value, etc. However, the sorting feature only works on the first page. The second page displays the default order rather than continuing the order ...
1
vote
1answer
560 views

Sort users in get_users() in custom order

<?php $blogusers = get_users('include=5,6,2,7,12,8'); foreach ($blogusers as $user) { ... } ?> Right now these users will sort by first name. How do I sort this the order the numbers ...
3
votes
2answers
2k views

Custom Post Type, WP_Query and 'orderby'

I do have a custom post type with the following setup: $supports = array( 'title' , 'editor' , 'thumbnail' , 'revisions' , 'page-attributes' ); $args = array( 'hierarchical' ...
2
votes
1answer
166 views

Sort by posts that have a featured image?

I'd like to sort posts on the index page to show those that have a featured image first. I've done this in functions.php: add_filter( 'pre_get_posts', 'my_get_posts' ); function ...
1
vote
1answer
399 views

Sorting multiple custom post types without a meta key/value pair by sort order

At this current moment. is it possible to sort multiple custom post/page types without a meta key/value? I'm looking to just sort the posts by page attribute order: What have i done so far? I've ...
0
votes
2answers
186 views

Custom Query Fields - Altering Meta Value

I'm giving Custom Query Fields a shot for filtering/sorting posts on the front-end of a site. The instructions seem pretty self-explanatory, but I do have another layer that I'm trying to figure out. ...
0
votes
1answer
412 views

Does wp track views for posts?

I want to do a query and sort posts by views. Is this possible? I'm not even sure where to start..
1
vote
4answers
1k views

Loop through all tags & output posts in alphabetical list

I have a bunch of posts that each have multiple tags, and I'm trying to find a way to output all of them on a single page, organized under an alphabetical listing of their respective tags. E.g. if ...
4
votes
4answers
5k views

Sorting a query by custom field date

EDIT: Reworded the question for more clarity I'm trying to sort by custom meta box data, which I am converting to a date using the strtotime function, but I'm having some difficulty. My chief ...
0
votes
1answer
364 views

orderby ignored by wp_query

With the following code, I do not get the result set ordered by titles. No matter what values I give to 'orderby' and 'order', I get the same ordering. The parameters seem to be ignored (or ...
1
vote
1answer
956 views

Order posts using a custom array

I have an array of post ids which I'm passing to query_posts using 'post__in'. My question is how can I use the order from my array rather than ordering by 'date' etc?
2
votes
1answer
523 views

Wordpress: Keep order of query_posts list of post ID's using post__in

I need to request a certain list of posts in the order I want. I'm getting the posts using: query_posts('category_name'=>'cases', 'posts_per_page'=>5, 'post__in'=>$_SESSION['sorting'], ...
3
votes
2answers
3k views

Sort posts alphabetically by custom field value, insert divider between different letters

i'm listing all posts of my custom post type "person" alphabetically sorted by the custom field last_name on a page. How would i insert a divider (e.g. an image of the letter) before a letter range ...
0
votes
1answer
1k views

Sorting the Loop by Taxonomy Value

This is a similar question to Sorting for each custom taxonomy, but I don't feel like it was clearly asked or responded to. I have a custom post type "player" and a custom taxonomy "player_details". ...