LoginSignup
1
1

More than 5 years have passed since last update.

一覧ページのargsの設定まとめ

Last updated at Posted at 2015-07-30

カテゴリ一覧

<?php 
$cat_now = get_the_category(); 

$args = array(
  'post_type' => 'post',
  'paged' => $paged ,
  'cat' => $cat_now[0]->term_id,
  'posts_per_page' => 4
);?>
<?php $the_query = new WP_Query( $args ); ?>
<?php if($the_query->have_posts()): ?>
<?php while($the_query->have_posts()): $the_query->the_post(); ?>

日付一覧(年月)

$year = get_query_var('year');
$monthnum = get_query_var('monthnum');
$args = array(
  'post_type' => 'post',
  'paged' => $paged ,
  'year' => $year,
  'monthnum' => $monthnum,
  'posts_per_page' => 4
);
<?php $the_query = new WP_Query( $args ); ?>
<?php if($the_query->have_posts()): ?>
<?php while($the_query->have_posts()): $the_query->the_post(); ?>

http://notebook.yamamotohiroyuki.com/wordpress/2012/08/15/%E3%81%A1%E3%82%87%E3%81%84%E3%81%A1%E3%82%87%E3%81%84%E5%BF%98%E3%82%8C%E3%82%8B%E3%80%8Ewp_query%E3%80%8F%E3%81%AE%E4%BD%BF%E3%81%84%E6%96%B9/
http://cthuwebdice.session.jp/wordpress/archive_php/
http://notnil-creative.com/blog/archives/1288

1
1
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1