Does query_posts have an effect on get_the_category?

The “main” query on the page is saved to a global called $wp_query. That global determines a great deal about the page, including both content and which template is used to display that content. Using $wp_query overwrites that main query and can cause some very basic things to fail but get_the_category() is probably not one … Read more

How can i show pagenavi in my author.php?

If you’re using the WP-PageNavi plugin, there are several FAQs on using it with a secondary query loop: http://wordpress.org/plugins/wp-pagenavi/faq/ this code is from one of the pages linked from that FAQ: $my_query = new WP_Query( array( ‘tag’ => ‘foo’, ‘paged’ => get_query_var(‘paged’) ) ); while ( $my_query->have_posts() ) : $my_query->the_post(); the_title(); // more stuff here … Read more

How to SQL query posts IDs by categories AND authors?

Not the best solution 😛 but this could help you: select distinct(p.ID) from wp_posts p, wp_term_relationships r, wp_term_taxonomy tt, wp_terms t WHERE p.post_author in (1, 2, 3) and r.object_id = p.ID and tt.term_taxonomy_id = r.term_taxonomy_id and tt.taxonomy = ‘category’ and tt.term_id = t.term_id and t.term_id in (1, 2, 3);

How to get specific string in explode array?

I see two problems here. One is that the explode() doesn’t actually specify the correct split string, which is ‘, ‘, WITH a space. What is written in the sample: ‘post_type’ => explode( ‘,’, $posttype ), What is written in the example shortcode: [myquery posttype=”cpt_press, cpt_two, cpt_three, cpt_etc”] Note that there is a comma AND … Read more