How to Order a list of taxonomies? orderby?

If you use the more generic get_terms you can include in the $args field all of the information to get the term or the children and specifically say what you want to order by and how you want it to be ordered. Ex. $termchildren = get_terms( “location”, array( ‘child_of’ => 4, ‘orderby’ => ‘name’, ‘order’ … Read more

Specify strict ‘order by’ in WordPress query

You could use usort(). Your callback function would need to determine the last names and sort by them. So, for instance: $args = array( ‘post_type’ = ‘Employees’, ); $employees = get_posts( $args ); usort( $employees, ‘wp91501_sort_employees’ ); and then your callback might be: function wp91501_sort_employees( $a, $b ) { // split the names into arrays … Read more

Order search results by category

I stumbled over this looking myself for a solution to order posts from WP_Query by their related terms, which seems to be the quintessence of this question. (I’ll answer to the special search case of the question below the general description.) Sorting Posts by related Terms So the key is the MySQL function FIELD() which … Read more

$wpdb->get_col and ORDER BY?

You don’t want ORDER BY $wpdb->postmeta.post_id rand(). If you had debugging enabled, you’d see an error. You need to separate ORDER BY values with a comma– ORDER BY $wpdb->postmeta.post_id, rand(). In your case, that won’t do any good because the first value gets precedence, so the query will order by the ID and then randomize … Read more

Orderby in Query Posts affected by operating system?

When these two values are the same, then your orderby statement does not tell how they should be ordered. In the SQL world, order is not an inherent property of a set of data. Thus, you get no guarantees from your RDBMS that your data will come back in a certain order — or even … Read more

change order of add_action hooks for jquery to be loaded first

I think the real answer here, is to have the plugin author load scripts properly using wp_enqueue_script(). Or, you could change the theme enqueue code to output jquery to the header by changing to this (not great for performance reasons, but relatively simple): wp_enqueue_script( ‘jquery’, get_template_directory_uri() . ‘/js/jquery/jquery.min.js’, array(), ‘1.0.0’, false ); Or, you could … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)