Order by meta value, pro first, then free

Before I fire away, just one note, NEVER (my emphasis) make use of query_posts to create custom queries Note: This function isn’t meant to be used by plugins or themes. As explained later, there are better, more performant options to alter the main query. query_posts() is overly simplistic and problematic way to modify main query … Read more

how to group custom post type posts by custom taxonomy terms

try using this fancy function that group the posts by term id that Scribu and Mike created: function event_clauses( $clauses, $wp_query ) { global $wpdb; if ( isset( $wp_query->query[‘orderby’] ) && ‘event_location’ == $wp_query->query[‘orderby’] ) { $clauses[‘join’] .=<<<SQL LEFT OUTER JOIN {$wpdb->term_relationships} ON {$wpdb->posts}.ID={$wpdb->term_relationships}.object_id LEFT OUTER JOIN {$wpdb->term_taxonomy} USING (term_taxonomy_id) LEFT OUTER JOIN {$wpdb->terms} USING … Read more

Display only the latest post from multiple categories

i think you’d have to use get_posts 5 different times. what about this: global $post; $posts = array(); //categories you want to pull latest posts from; $cats = (1,2,3,4,5); foreach($cats as $cat): $args = array( ‘numberposts’ => 1, ‘category’ => $cat ); $posts[] = get_posts($args); endforeach; if($posts): ?> <ul> <?php foreach( $posts as $post ) … Read more

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