ページ送り 【決定版】

WordPressのページ送りプラグイン【WP-PageNavi】を入れておく

example.phpを作成 → inc フォルダにアップしろ
↓以下をまるまるコピペ

<?php
 
$paged = get_query_var('paged', 1);
$query = new WP_Query(
    array(
        'paged' => $paged,
        'posts_per_page' => 9,
		
		/*↓カテゴリを指定する場合
        'category_name' => 'voice',
		↑ここまで*/
		
        'post_type' => 'post',
    )
);
?>
<?php
 
if ( $query->have_posts() ) : ?>
<ul>
 <?php while ( $query->have_posts() ) : $query->the_post();?>
  
    <!–↓ここからレイアウト–>
    <div class="topgazou">
 
 

 
 <?php
if ( has_post_thumbnail() ):
    // アイキャッチ画像があるときの処理
    ?> <a href="<?php the_permalink() ?>" title="<?php the_title(); ?>"><?php the_post_thumbnail(array(71, 70)); ?></a><?php
else:
    // アイキャッチ画像がないときの処理
    ?><a href="<?php the_permalink() ?>" title="<?php the_title(); ?>"><img src="/noimage.jpg" width="71" height="70"/></a><?php
endif;
?>
 
 
 </div>
    
   <li class="newsbox"><span id="cate-icon" class="<?php $cat = get_the_category(); $cat = $cat[0]; {echo "$cat->category_nicename";} ?>"><?php echo $cat->cat_name; ?></span>
<a href="<?php the_permalink() ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a><?php
$days = 7; //Newを表示させたい期間の日数
$today = date_i18n('U');
$entry = get_the_time('U');
$kiji = date('U',($today - $entry)) / 86400 ;
if( $days > $kiji ){
echo '<font color="#ff0000″ style="font-size: 12px"><strong> New!</strong></font>';
}
?>
        <div id="bassui"><?php the_excerpt(); ?></div>
        
        </li>
        
        <div class="ccc"></div>
        <hr>
  <!–↑ここまで–>
    
    
<?php endwhile; ?>
</ul>
<?php else : ?>
<p>現在表示する記事はありません</p>
 
<?php endif; ?>
 
/* プラグインWP-PageNaviナビ出力コード ↓↓ */
 
<?php wp_pagenavi(array('query' => $query)); ?>
 
<?php wp_reset_postdata(); ?>

適当な固定ページに

[myphp file='example']

を挿入!で完成!!