Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options answers only not deleted user 21376

A parameter used in queries to specify the type and direction of sorting.

1 vote
Accepted

Order posts by price

You are storing your "price" (apparently) as human readable formatted currency. That makes it a string. And that means it is going to be sorted alphabetically, more or less, and not numerically as you …
s_ha_dum's user avatar
  • 65.5k
0 votes
Accepted

Ordering Subcategories

unset($cats[$cat]); array_unshift($cats,$tmp); } return $cats; } $parent = get_cat_ID('aciform'); $children = get_categories( array( 'child_of' => $parent, 'orderby' => 'date', 'order
s_ha_dum's user avatar
  • 65.5k
2 votes
Accepted

Orderby with menu_order and title

Like MySQL, WP_Query does not have a "natural sort" feature but if what you want is to order by menu_order where that menu_order is greater than 0, and otherwise by title, which is what I think you want …
s_ha_dum's user avatar
  • 65.5k
1 vote
Accepted

All, published and pending order

Filter views_edit-post. function tst($a) { // var_dump(get_defined_vars()); $tst = array(); $tst['future'] = $a['future']; $tst['publish'] = $a['publish']; $tst['all'] = $a['all'] …
s_ha_dum's user avatar
  • 65.5k
0 votes

I want to display the all the posts that are inside a certain subcategory

post__in will preserve the order of the values you give it. 'post_in' - Preserve post ID order given in the post_in array (available with Version 3.5). …
s_ha_dum's user avatar
  • 65.5k
1 vote

Multiple Orderby's using random order WP_Query

ORDER BY wp_postmeta.meta_value+0,RAND() DESC ... which is what I expected. If I am reading your question correctly, what you want is ... … You can see in the source that the order "direction" is tacked onto the end of the order by string. It always ends up in the wrong place for you. …
s_ha_dum's user avatar
  • 65.5k
1 vote
Accepted

Order by Custom Field date not recognized

I can't get a meta_key parameter to pass through a GET string at all. Many other parameters that I tested do pass through, though I did not do an exhaustive test, but meta_key does not. If you want …
s_ha_dum's user avatar
  • 65.5k
0 votes
Accepted

Order by custom field in query multiple

You need 'order_by' => 'post__in' in the last query in order to "Preserve post ID order given in the post__in array (available with Version 3.5).". … I don't know if the order you are passing in is the order you want after the array_merge( $group_1, $group_2). …
s_ha_dum's user avatar
  • 65.5k
1 vote

Posts and order

'page-attributes' (template and menu order) (hierarchical must be true) (the page template selector is only available for the page post type) ... and posts are not hierarchical. … Additionally, that 'order' values in not used very much by default, and certainly not by "post" post type queries so you'd need to alter a number of queries to get that to work. …
s_ha_dum's user avatar
  • 65.5k
4 votes

Sorting Attributes order when using get_the_terms

You will need to sort them yourself: $terms = get_the_terms( $post->ID, 'category'); foreach ( $terms as $term ) { $newterms[$term->slug] = $term; } ksort($newterms); foreach ( $newterms as $t …
s_ha_dum's user avatar
  • 65.5k
4 votes
Accepted

the_tags() : display the tags by the order they are typed in in the backend, not alphabetically

Rabbit: the_tags() get_the_tag_list() get_the_term_list() get_the_terms() wp_get_object_terms() If you look through that last function, you should see this: $defaults = array('orderby' => 'name', 'order … ' => 'ASC', 'fields' => 'all'); You should have alphabetical order by default. …
s_ha_dum's user avatar
  • 65.5k
1 vote

wp_list_categories() by alphabet? (ex. only category titles that start with “A”)

wp_list_categories() uses the Walker_Category walker which applies the list_cats filter, so a little PHP and: function alpha_prefix_wpse_210205($cat) { $fl = substr($cat,0,1); $fl = strtoupper($f …
s_ha_dum's user avatar
  • 65.5k
1 vote

Displaying Portfolio Filter by Category Order (alphabetically)

examples in the Codex): $loop = new WP_Query( array ( 'post_type' => 'europe', 'posts_per_page' => -1, 'orderby' => 'meta_value', 'meta_key' => 'country' 'order
s_ha_dum's user avatar
  • 65.5k
1 vote

get_terms orderby name as numbers

There are many similar posts on the forum, if you look around. You do not have numbers. Therefore you cannot sort numerically. You have to sort alphabetically and that will give you the pattern you …
s_ha_dum's user avatar
  • 65.5k
0 votes

List upcoming events, ordered by date in a custom field

If you store dates as YYYY-MM-DD, and sort numerically you will get an order matching human-calendar order. Another option is to store the dates in UNIX-time. … Similar question, possibly a duplicate: order post my meta value m/d/y format with year as included value …
s_ha_dum's user avatar
  • 65.5k

15 30 50 per page