Pagination on with query_posts in custom post type template

@Milo Thanks, the pre_get-posts seems to work perfectly. I was missing that before, thought my choices were between wp_query and query_posts. The below should ONLY alter the query on the “rg_blog” custom post type archive, right? function blog_filter($query) { if ( !is_admin() && $query->is_main_query() ) { if ($query->is_post_type_archive(‘rg_blog’)) { $query->set(‘post_type’, ‘post’); } } } add_action(‘pre_get_posts’,’blog_filter’);

using $wpdb to get custom post type with term

Any suggestions on how to get the title of the first custom post type of ‘property’ with the term ‘Locked’ in the taxonomy ‘status’? $args = array( ‘post_type’ => ‘property’, ‘tax_query’ => array( array( ‘taxonomy’ => ‘status’, ‘field’ => ‘slug’, ‘terms’ => ‘locked’ ) ) ); $your_query = new WP_Query( $args ); while ( $your_query->have_posts() … Read more

Search / Filter posts on Title/Content OR Tags

I worked it out myself.. The query I was looking goes like this: SELECT * FROM $wpdb->posts, $wpdb->term_relationships, $wpdb->term_taxonomy, $wpdb->terms WHERE ($wpdb->terms.name LIKE ‘%$s%’ OR $wpdb->terms.slug LIKE ‘%$s%’ OR $wpdb->posts.post_content LIKE ‘%$s%’ OR $wpdb->posts.post_title LIKE ‘%$s%’) AND $wpdb->posts.ID = $wpdb->term_relationships.object_id AND $wpdb->term_relationships.term_taxonomy_id = $wpdb->term_taxonomy.term_taxonomy_id AND $wpdb->term_taxonomy.term_id = $wpdb->terms.term_id AND $wpdb->posts.post_status=”publish” AND $wpdb->posts.post_type=”products” ORDER BY $wpdb->posts.post_date … Read more

How do i calculate the total of values of custom fields in custom post types?

It’s a matter of keeping a running total. Because I’m not 100% clear on the question, below I am providing the changes / pseudo-code for what you want to do: <?php if ( is_user_logged_in() ): global $current_user; get_currentuserinfo(); // ADDED: Initialize the total variable to prevent warnings $grandtotal = 0; $author_query = array(‘posts_per_page’ => ‘-1′,’author’ … Read more