How to organize a WP_Query’s list of posts by category and display category title?
How to organize a WP_Query’s list of posts by category and display category title?
How to organize a WP_Query’s list of posts by category and display category title?
Fire query on ajax post url page
In my case I use a custom query so I can just use: $query = new WP_Query(array(‘post_type’ => ‘akteur’, ‘meta_query’ => array( ‘relation’ => ‘OR’, array(‘key’ => ‘wpcf-kurzbeschreibung’,’compare’ => ‘LIKE’,’value’ => $suchbegriff), array(‘key’ => ‘wpcf-zusatzinfo’,’compare’ => ‘LIKE’,’value’ => $suchbegriff) ) ));
Horizontally paginate through sets of blog posts?
You can only sort on 1 meta value. A few posts (including this SE answer) suggest adding a filter to change the order. Add a function to your theme’s function.php file that will replace the sort order: function change_sort_order( $orderby ) { return str_replace(‘wp_posts.post_date’, ‘mt2.meta_value, mt1.meta_value’, $orderby); } Then use it where you want. Make … Read more
Don’t use query posts ever, my emphasis. It is just a bad function to use 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 of a page … Read more
Filter WP_Query output before it is accessed (pre_get_posts)?
I believe that you’re asking about post format and not post type. Assuming that’s correct, you’ll probably be using WP_Query to query all posts of the post format “Standard.” However, as noted in this trac ticket, there’s strangely no way to query for the standard post format. Instead you need to query for all posts … Read more
Year based WP Query
Thanks @Marin Atanasov and @hobo to help me to solve my problem on stackoverflow. If you are interested you can check the solution here The problem was in the way i wrote the query, because it needs quotes around the date (eg = ‘”.$data_modifica_post.”‘).