Sort query by author: 1 author, then others

You could do that with a custom posts_orderby: add_filter( ‘posts_orderby’, ‘wpa58715_posts_orderby’ ); function wpa58715_posts_orderby( $orderby_statement ) { if ( is_post_type_archive( ‘article’ ) ) { global $wpdb; $orderby_statement = “FIELD($wpdb->posts.post_author, 42) DESC, $wpdb->posts.post_author”; return $orderby_statement; } } Swap in your author ID for 42.

Display posts with a start OR end date later than current date

Edit: I believe my comments below are still valid, but I suspect part of the problem is the ‘relation’ => ‘OR’, This should be ‘AND’ (it’s default value,so it can be removed) to ensure that it only returns posts which satisfy both conditions. Currently it will return events that start, or end, after yesterday. In … Read more

Most liked page not displaying posts

Thats code just querying the posts by sorting it by meta value, but you have no loop for the posts to display. Add the loop after the query for something like this: echo ‘<ul>’; if ( have_posts() ) : while ( have_posts() ) : the_post(); echo ‘<li>’; the_title(); echo ‘</li>’; endwhile; endif; echo ‘</ul>’;

mysql query from wordpress page using custom table

I think if you add a couple of periods before and after the php variable in your query, remove the use of mysql_fetch_array, and use get_row(), it should work better. Here’s how I would get a park from your custom table: <?php $page_title = wp_title(”); $park = $wpdb->get_row(“SELECT * FROM $wpdb->park_data WHERE park_name=””.$page_title.”””); if($park) { … Read more

Get parse_query filter to return slug instead of id

taxonomy & term won’t be set (in this case), since query vars are mapped from GET/POST. In other words, $qv[‘large_feature’] = 291 (see wp_edit_posts_query() and WP_Query::get_posts() for the big picture). add_filter( ‘parse_query’,’convert_large_feature_id_to_taxonomy_term_in_query’ ); function convert_large_feature_id_to_taxonomy_term_in_query( $query ) { global $pagenow; $qv =& $query->query_vars; if ( $pagenow == ‘edit.php’ && isset( $qv[‘large_feature’] ) && ctype_digit( $qv[‘large_feature’] … Read more

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