I have a page template named overview.php which inside shows all the pages that are of the same category. As a result all the pages with the same category are printed but so is the current main page,because it is of the same category as well, and I don’t want this to happen. So inside the loop I want to get the ID of every queried page and compare it to current main page ID so that nothing will happen when it is looped.
This is how I query the pages:
$paged = (get_query_var( ‘paged’ )) ? get_query_var( ‘paged’ ) : 1;
$args = array(
‘post_type’ => ‘page’,
‘post_status’ => ‘Published’,
‘category_name’ => ‘Football League’,
‘posts_per_page’ => 12,
‘paged’ => $paged,
$arr_posts = new WP_Query( $args );
if ( $arr_posts->have_posts() ) :
while ( $arr_posts->have_posts() ) :
prints something about each page..
‘query’ => $arr_posts,