Tag Info

Hot answers tagged

1

I was going to create my own question and answer it, but this looks as good a place as any. The way I solved this, is by using $_SESSION. Keep in mind I am using infinite-scroll, so I can tell when the page is being fetched via ajax as opposed to being actually navigated to in the browser. So here's the steps/pseudo-code: Clear Session Variables Run ...


1

Never use query_posts, use pre_get_posts to modify any main query. function wpd_exclude_author_category( $query ) { if ( $query->is_author() && $query->is_main_query() ) { $query->set( 'category__not_in', array( 42 ) ); } } add_action( 'pre_get_posts', 'wpd_exclude_author_category' );


1

rearrange your code and use post_count; example: <?php $movieNumber = 1; $today = date('Ymd'); $posts = array ( 'post_type' => 'movie', 'posts_per_page' => -1, ); $loop = new WP_Query( $posts ); ?> <div id="posters<?php echo $loop->post_count; ?>"> ...



Only top voted, non community-wiki answers of a minimum length are eligible