Breaking News

Saturday 24 March 2018

auto news


publish; // Posts per page $per_page = 9; // Determine total amount of pages $total_pages = ceil($numposts / $per_page); // Get current page $paged = (get_query_var( 'page' )) ? get_query_var( 'page' ) : 1; // Above your loop $ignores = array(); // If we have sent ignore ID's if ( $_GET['ignore'] ) { $get_ignores = trim($_GET['ignore'], ','); $get_ignores = explode(',', $get_ignores); } // If we have ignore ID's if ( !empty($get_ignores) ) { foreach ($get_ignores AS $k => $v) { $ignores[] = $v; } } $count = 1; $my_args = array( 'posts_per_page' => 9, 'paged' => get_query_var( 'page' ), 'post__not_in' => $ignores, 'post_status' => 'publish' ); $my_query = new WP_Query($my_args); if ( $paged <= $total_pages): $paged = $paged + 1; // The loop while ( $my_query->have_posts() ): $my_query->the_post(); // At the start of the loop populate the used post ID's $ignores[] = $post->ID; ?>

$v ) { $ignore_str .= $v.','; } // Trim the ignore string of any rogue commas $ignore_str = ltrim($ignore_str, ','); $ignore_str = rtrim($ignore_str, ','); $ignore = site_url('page/'.$paged.'/?ignore='.$ignore_str.''); } ?> Load More Posts
have_posts() ) : ?>

No comments:

Post a Comment