The tag has no wiki summary.

learn more… | top users | synonyms (1)

11
votes
5answers
3k views

Can the Next/Prev Post links be ordered by menu order or by a meta key?

I have a series of posts that are ordered by a meta_key value. They could also be arranged by menu order, if necessary. The next/prev post links (generated by next_post_link, previous_post_link, or ...
7
votes
1answer
9k views

How to query_posts using meta_query to orderby meta_key AND have a secondary sort by date?

I've been troubleshooting an issue over the past few days and keep going in circles. Could really use a fresh pair of eyes to help me answer this question... So I'm working with a wordpress site ...
6
votes
5answers
2k views

get_pages() not ordering as it should

I'm using get_pages() function to get all subpages from a page like this: $childrens = get_pages(array('child_of' => 7, 'sort_column' => 'post_date', ...
6
votes
2answers
3k views

Sort admin menu items

On a related note to "Changing the Order of Admin Menu Sections?", I'm looking for a way to alphabetically sort the entries in each sub-section of WordPress's admin area. Currently, whenever a new ...
6
votes
2answers
380 views

sort child pages on admin

I have a hierarchical CPT with the following structure: - parent item 1 - child item 1 - child item 2 - child item 3 - child item 4 - child item 5 - parent item 2 - child item 1 ...
5
votes
1answer
5k views

Using meta_query, how can i filter by a custom field and order by another one?

With the following code (in functions.php) my posts (of CPT event) are ordered by _end_date instead of _start_date. What's the proper solution to this as of WP 3.1.3? Of course I'd like to avoid using ...
5
votes
3answers
4k views

Plugin for custom sort order for categories?

I'd like to employ a sort order option in my theme to allow categories to be sorted similar to pages. Can anyone recommend a plugin that does this?
5
votes
2answers
380 views

Can I force a metabox to be in one column?

Suppose I created a custom metabox for the add/edit post page that uses a wide width (not suitable for being in the sidebar), is there a way of keeping it in the middle column only and sortable while ...
5
votes
5answers
1k views

Different post sort order within different categories

I need to give each post a unique post order for multiple Categories (per post) it is in. I can imagine a solution using custom fields whereby for each Category there is a corresponding custom field ...
5
votes
3answers
2k views

sortable custom column in media library

trying to make a custom column sortable in the media library. Found lots of examples for posts, and users but can't get them to work on the media library page. function wpse_hook_isv_columns() { ...
5
votes
6answers
3k views

visually sort ordering “custom post types” for end users

Now with those custom post types and other bits of content that don't necessarily need to be organized chronologically by date, for example: the client has a 100 T-Shirts as custom post type "SHIRT" ...
4
votes
5answers
4k views

How to return results of a get_posts() in explicitly defined order

I'm trying to create a loop of explicity ordered posts, for example: <?php $args = array( 'include' => '1,3,8,4,12' ); ?> <?php get_posts( $args ); ?> The results are ...
4
votes
1answer
2k views

Sortable admin columns, when data isn't coming from post_meta

I have a custom post type that uses a custom taxonomy. I'm imposing a limit of a single term to each post (using a custom meta box drop down on the edit post screen for the CPT). The term for the ...
4
votes
4answers
6k 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 ...
4
votes
6answers
7k views

Custom order of terms for custom taxonomy in admin and website

I have a custom taxonomy registered for my custom post type. I need to make it possible for a user to specify the order in which the taxonomy terms should appear (something like menu order for pages). ...
4
votes
1answer
2k views

How to order adjacent posts (prev / next) by custom field value?

I am using the More Fields and More Types plugins to create a custom post type called product. This custom type is based on the Post type. One of the fields is named lot which is an integer ...
4
votes
1answer
3k views

Custom sortable columns ordered by meta-value?

I have no idea why my sortable function does not sort my "events" my a custom post-meta. I have a custom-post-type named wr_event… I have my custom columns set up and my post-meta is shown in the ...
4
votes
1answer
70 views

How to sort terms with diacritical signs?

I have list of terms which happens to be the Polish Alphabet. Here's how I list these terms: <ul> <?php $terms = get_terms("taxonomy", array('orderby' => 'title', 'hide_empty' => ...
4
votes
1answer
230 views

WordPress: Sortable Metabox Fields Not Saving Position

I've run into a problem that has got me stumped: after upgrading to WP 3.6 my sortable metabox fields are not saving their position when you re-order them. Below is my code: PHP: function save_box( ...
4
votes
1answer
448 views

How do I allow users to sort posts? [duplicate]

Possible Duplicate: How do I sort multiples pages? I want to allow users to sort a long list of posts (that are displayed on multiple pages) by custom fields. Here is my form... <form ...
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' ...
3
votes
2answers
857 views

Sort custom post type list table by display name of a user id stored as post meta value

I have a custom post type named domicile. Each post (domicile) has an owner (not the author). Owners are users with a custom role. I store the user id as a post meta value (dmb_owner) for the domicile ...
3
votes
1answer
1k views

How can I custom order the results from wp_list_categories?

I am using wp_list_categories to return (you guessed it) a list of categories within a custom taxonomy. The orderby parameter accepts sorting by ID, name, slug, count, and term_group. Is there a way ...
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 ...
3
votes
1answer
3k views

Custom Taxonomy Template Post List with Sort Order

I have an interesting problem I am trying to solve. Here is my situations: I have create a custom post type for "events". For each event post I require custom fields to be entered for the event ...
3
votes
1answer
986 views

Auto sort the wp-admin post list by a meta key

I am using this following code in my functions file to hide and add some custom columns to my post-edit screen in wp-admin. I am now trying to get the post list to sort by a post meta field (last ...
3
votes
2answers
519 views

Sort X categories by last update and show image

I want to display X categories, and sort them by last update. I also want to grab the image of the latest post with the category. <img src="<?php echo ...
3
votes
2answers
2k views

Archive sorting functions by custom fields (front-end)

I want to give the users the ability to sort the posts in the archive by some custom fields that I pre-define. The end result would be en a tabbed container, and the user will click on the relevant ...
3
votes
3answers
608 views

Fulltext search in posts sorted by relevancy

I'm building a custom search page and what I need is to sort results by relevancy (eg. occurences of a keyword) Using MySQL docs I've built this query: SELECT ID FROM $wpdb->posts WHERE MATCH ...
3
votes
1answer
643 views

Sort posts by number of matched terms

I have form where I list all terms associated with posts as check boxes, user should pick few of them, hit search and get all posts that match all chosen terms. It works great when there are posts ...
3
votes
1answer
324 views

Sorting by tag or category

Here's the scenario: A user clicks on a tag which takes them to a list of all those posts with that tag. There are hundreds of posts, so the user needs a way to filter these. Here's the question: ...
3
votes
0answers
408 views

Plugin for sortable posts in grid [closed]

I'm looking for a plugin that will emulate this current php page: Each flower to be a post with more info. The dates to be sortable Current blooming flowers to be featured in the widget sidebar ...
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( ...
2
votes
1answer
1k views

Adding meta_key via pre_get_posts causes navigation to disappear

I'm writing a custom function that allows the posts to be sorted based on a custom field. When the user submits the "sort by" form, the meta_key (as well as orderby and order) parameters by which the ...
2
votes
3answers
2k views

Sorting results from JSON-API on custom fields

Is there any way, out of the box, to sort results from the JSON-API plugin based on values in custom fields? The request is paged, so the results will need to be sorted server-side. I have an http ...
2
votes
1answer
3k views

Sort pages in loop by admin's page attributes order field?

Is it possible to sort pages in the loop using the admin's order field (under page attributes)?
2
votes
2answers
606 views

Is it possible to order posts by two meta values?

Hopefully this is a reasonably straightforward question! Is it possible to order posts, on the front-end of my WP install, by two meta values? I have a meta key called genus and another called ...
2
votes
1answer
172 views

Arrange and separate posts

On a particular archive page I've created, I'm listing a number of posts by post name and they're listed in alphabetical order. Is there away to have them separated even further? As in all posts ...
2
votes
2answers
250 views

Sort Posts Best Practice

I have a custom post type "Properties". These properties posts are being listed out on page "Properties For Let". Each property post has various custom meta including price, and number of bedrooms. ...
2
votes
2answers
9k views

Setting Custom Sort Order of Posts within a Category

I've got this category setup that includes several posts. By design it's not a blog, but a staff listing. Currently all of the staff members have their own posts with the category. I'd like to be able ...
2
votes
1answer
535 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'], ...
2
votes
1answer
181 views

Sort a custom post type array numerically

We've set up drop down lists to allow people to filter posts based on custom post types. In order to populate the drop down list I am using: <?php $terms = get_terms("ratios"); $count = ...
2
votes
2answers
1k views

Sort by custom field value

I have a page where I only want to show posts from a specific category. At the same time, I want the posts to be sorted by a custom field value in my posts: query_posts('category_name=' . ...
2
votes
1answer
563 views

blog posts sorting doesnt work while using get_query_var

I'm trying to show the latest posts using the get_query_var function. The function filters the posts according to their category. When I'm displaying the posts on the page they appear unsorted ...
2
votes
2answers
868 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: ...
2
votes
1answer
317 views

Using database meta_values to calculate new post order using pre_get_posts or a 'request' hook

UPDATE: I have worked out my implementation of the selected answer at the bottom of this post. I'm implementing a sorting algorithm based on Reddit's hotness algorithm, in addition to a time-decay ...
2
votes
3answers
489 views

get_terms orderby name as numbers

I have a custom taxonomy filled with terms such as 'volume 1', 'volume 2', 'issue 1', 'issue 2', 'issue 10' and get_terms orderby name returns list as: issue 1, issue 10, issue 2 though I need it to ...
2
votes
2answers
538 views

Search results sorted by post types

I am working on a site with several post types - 4 to be exact - and I am trying to setup the search results page to have a filter/sort the results by post types. For example, when a person searches ...
2
votes
1answer
96 views

What table is the media's sort order stored?

I see that your can sort media by a numbered order in the media gallery for a post. But what table is this order stored in? I want to use this order to also order the images the same way in my ...
2
votes
1answer
177 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 ...