• 赤色のリンクは、まだ日本語Codexに存在しないページ・画像です。英語版と併せてご覧ください。(詳細

このWikiはいつでも誰でも編集できます

The Loop

提供: WordPress Codex 日本語版
2005年1月29日 (土) 20:32時点におけるOtsukare (トーク)による版

(差分) ← 古い版 | 最新版 (差分) | 新しい版 → (差分)
移動先: 案内検索
このページ「The Loop」はまだ書きかけで、情報が不足しています。続きを書いて WordPress を手助けしましょう.


"The loop" is where WordPress displays each of your posts. This is where WordPress processes each of the posts that should be displayed on the current page and formats them all in the same way. For example, WordPress shows the Title, Date, and Category for each post. The $post variable is set with the current post's information inside of the loop. The loop is in the index.php file but looks slightly different depending on your version of WordPress. You can first "find what version of WordPress you have".

WordPress 1.5

Include the call for header.php at the top of your index page. Remember, the path for header.php must be set to the location of your header.php file:

<?php include('header.php'); ?>

The loop starts here:

<?php if (have_posts()) : while (have_posts()) : the_post(); ?>

and ends here:

<?php endwhile; else: ?>
<p><?php _e('Sorry, no posts matched your criteria.'); ?></p>
<?php endif; ?>

WordPress 1.2

Include the call for wp-blog-header.php at the top of your index page. Remember, the path for wp-blog-header.php must be set to the location of your wp-blog-header.php file:

<?php /* Don't remove this line. */ require('./wp-blog-header.php'); ?>

The loop starts here:

<?php if ($posts) : foreach ($posts as $post) : start_wp(); ?>

and ends here:

<?php endforeach; else: ?>
<p><?php _e('Sorry, no posts matched your criteria.'); ?></p> 
<?php endif; ?>