Я хотел бы помочь получить мою разбивку на страницы для работы

Когда я нажимаю на любую ссылку в разбивке на страницы, она показывает пустую страницу. вперед и назад. и число опубликованных сообщений, которые показывают, отключено на два числа. пожалуйста помоги.

<?php $per_page = 5; $connection = mysqli_connect('localhost','root','root','wordpress'); if($connection){ echo 'connected to the database'; } else { echo 'not connected to the database'; } ?> <?php if(isset($_GET['page'])){ $page = $_GET['page']; } else { $page = ""; } if($page == "" || $page == 1) { $page_1 = 0; } else { $page_1 = ($page * 5) - 5; } ?> <?php $post_query_count = "SELECT * FROM wp_posts"; $find_count = mysqli_query($connection,$post_query_count); $count = mysqli_num_rows($find_count); $count = ceil($count / $per_page); echo $count; $query = "SELECT * FROM wp_posts LIMIT $page_1, 5"; $select_all_posts_query = mysqli_query($connection,$query); while($row = mysqli_fetch_assoc($select_all_posts_query)) { $post_id = $row['ID']; // is this post_id or ID? $post_title = $row['post_title']; // $post_author = $row['post_author']; // $post_date = $row['post_date']; // $post_image = $row['post_image']; $post_content = substr($row['post_content'],0,400); // $post_status = $row['post_status']; // if($post_status == 'published'){ } } ?> <h1><?php echo 'total blog post' . "" . $count ?></h1> <!-- below is the default wordpress php loop code block --> <?php if (have_posts()) : ?> <?php while (have_posts()) : the_post(); ?> <div <?php post_class() ?> id="post-<?php the_ID(); ?>"> <!--beginning of title above --> <!-- blog Headers below --> <h2><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h2> <!--end of title above --> <!-- Featured image --> <div class="entry"> <!-- date posted on and by the author --> <?php include (TEMPLATEPATH . '/inc/meta.php' ); ?> <a href="<?php the_permalink(); ?>"> <div class="blogInsert"><?php the_post_thumbnail('small-thumbnail'); ?></a></div> <?php the_content('Continue reading &raquo;'); ?> </div><!--end of the blog entry--> <!-- beginning of entry is either featured image or the middle piece--> <!--begin of the catagorized & comments --> <div class="postmetadata"> <?php the_tags('Tags: ', ', ', '<br />'); ?> Posted in <?php the_category(', ') ?> | <?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?> </div> <!--end of the catagorized & comments --> </div><!--end of blogEntry--> <?php endwhile; ?> <?php next_posts_link('Older Entries'); ?> <?php previous_posts_link('Newer Entries'); ?> <?php else : ?> <h2>Not Found</h2> <?php endif; ?> <?php $ourCurrentPage = get_query_var('paged'); $aboutPosts = new WP_query(array('category_name' => 'about', 'posts_per_page' => 5, 'paged' => $ourCurrentPage )); ?> <ul class="paging-navigation"> <br> <br> <?php for($i =1; $i <= $count; $i++) { echo "<li><a href='index.php?page={$i}'>{$i}</a></li>"; } ?> </ul>