採用サイト制作に最適なWordPressテーマ「ISSUE」の機能概要

ワードプレステーマ別

TCDテーマCORE:タブ記事一覧の表示件数を変更する方法

Q.タブ記事一覧に表示される記事の件数を変更したい

A.下記のPHPファイルの該当箇所を編集します

編集するファイル:index.php

編集する箇所:

・タブ記事一覧1

 <?php // #index_post_list1 *************************************************************************************************** ?>
 <?php if($options['show_index_post_list1'] == 1) { ?>
 <div id="index_post_list1" class="index_post_list clearfix">
  <?php
       $args = array('post_type' => 'post', 'ignore_sticky_posts' => 1, 'posts_per_page' => 5);
       $index_post_list1 = get_posts($args);
       if ($index_post_list1) {
         $i = 1;
         foreach ($index_post_list1 as $post) : setup_postdata ($post);
  ?>

 <?php // #index_post_list1 *************************************************************************************************** ?>
 <?php if($options['show_index_post_list1'] == 1) { ?>
 <div id="index_post_list1" class="index_post_list clearfix">
  <?php
       $args = array('post_type' => 'post', 'ignore_sticky_posts' => 1, 'posts_per_page' => ●);
       $index_post_list1 = get_posts($args);
       if ($index_post_list1) {
         $i = 1;
         foreach ($index_post_list1 as $post) : setup_postdata ($post);
  ?>

 

・タブ記事一覧2

 <?php // #index_post_list2 *************************************************************************************************** ?>
 <?php if($options['show_index_post_list2'] == 1) { ?>
 <div id="index_post_list2" class="index_post_list clearfix">
  <?php
       $args = array('post_type' => 'post', 'ignore_sticky_posts' => 1, 'posts_per_page' => 5, 'meta_key' => 'popular_post', 'meta_value' => 'on', 'orderby' => $options['index_post_list_order1']);
       $index_post_list2 = get_posts($args);
       if ($index_post_list2) {
         $i = 1;
         foreach ($index_post_list2 as $post) : setup_postdata ($post);
  ?>

 <?php // #index_post_list2 *************************************************************************************************** ?>
 <?php if($options['show_index_post_list2'] == 1) { ?>
 <div id="index_post_list2" class="index_post_list clearfix">
  <?php
       $args = array('post_type' => 'post', 'ignore_sticky_posts' => 1, 'posts_per_page' => ●, 'meta_key' => 'popular_post', 'meta_value' => 'on', 'orderby' => $options['index_post_list_order1']);
       $index_post_list2 = get_posts($args);
       if ($index_post_list2) {
         $i = 1;
         foreach ($index_post_list2 as $post) : setup_postdata ($post);
  ?>

 

・タブ記事一覧3

 <?php // #index_post_list3 *************************************************************************************************** ?>
 <?php if($options['show_index_post_list3'] == 1) { ?>
 <div id="index_post_list3" class="index_post_list clearfix">
  <?php
       $args = array('post_type' => 'post', 'ignore_sticky_posts' => 1, 'posts_per_page' => 5, 'meta_key' => 'featured_post', 'meta_value' => 'on', 'orderby' => $options['index_post_list_order2']);
       $index_post_list3 = get_posts($args);
       if ($index_post_list3) {
         $i = 1;
         foreach ($index_post_list3 as $post) : setup_postdata ($post);
  ?>

 <?php // #index_post_list3 *************************************************************************************************** ?>
 <?php if($options['show_index_post_list3'] == 1) { ?>
 <div id="index_post_list3" class="index_post_list clearfix">
  <?php
       $args = array('post_type' => 'post', 'ignore_sticky_posts' => 1, 'posts_per_page' => ●, 'meta_key' => 'featured_post', 'meta_value' => 'on', 'orderby' => $options['index_post_list_order2']);
       $index_post_list3 = get_posts($args);
       if ($index_post_list3) {
         $i = 1;
         foreach ($index_post_list3 as $post) : setup_postdata ($post);
  ?>

※●は表示する件数を記述下さい。

この記事は役に立ちましたか?

もし参考になりましたら、下のボタンで教えてください。
今後の記事作成の参考とさせて頂きます!

同じテーマのカスタマイズ記事