single.php の詳細

<!-- ヘッダーを埋め込む -->
<?php get_header(); ?>

    <div id="content" class="widecolumn">

<!-- if 投稿が存在するかを確認する条件文 *1 -->
<!-- while 投稿データを取得するループ *2 -->
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>

        <div class="navigation">
<!-- previous_posts_link は前の記事へのリンクを表示する -->
            <div class="alignleft"><?php previous_post_link('&laquo; %link') ?></div>
<!-- next_posts_link は次の記事へのリンクを表示する -->
            <div class="alignright"><?php next_post_link('%link &raquo;') ?></div>
        </div>

<!-- post_class() は カテゴリやタグなどのメタ情報をクラスとして付与 since 2.7 -->
<!-- the_ID() は 記事の ID -->
        <div <?php post_class(); ?> id="post-<?php the_ID(); ?>">
<!-- the_title() は 見出しを表示する -->
            <h2><?php the_title(); ?></h2>

            <div class="entry">
<!-- the_content() は 本文を表示する -->
                <?php the_content('<p class="serif">' . __('Read the rest of this entry &raquo;', 'kubrick') . '</p>'); ?>

<!-- ページ分割 nextpage を使う場合のページナビ -->
                <?php wp_link_pages(array('before' => '<p><strong>' . __('Pages:', 'kubrick') . '</strong> ', 'after' => '</p>', 'next_or_number' => 'number')); ?>
<!-- the_tags() は タグを表示する -->
                <?php the_tags( '<p>' . __('Tags:', 'kubrick') . ' ', ', ', '</p>'); ?>

                <p class="postmetadata alt">
                    <small>
                        <?php /* This is commented, because it requires a little adjusting sometimes.
                            You'll need to download this plugin, and follow the instructions:
                            http://binarybonsai.com/archives/2004/08/17/time-since-plugin/ */
                            /* $entry_datetime = abs(strtotime($post->post_date) - (60*120)); $time_since = sprintf(__('%s ago', 'kubrick'), time_since($entry_datetime)); */ ?>
<!-- 投稿日時、カテゴリ等を表示 -->
                        <?php printf(__('This entry was posted %1$s on %2$s at %3$s and is filed under %4$s.', 'kubrick'), $time_since, get_the_time(__('l, F jS, Y', 'kubrick')), get_the_time(), get_the_category_list(', ')); ?>
<!-- コメント RSS を表示 -->
                        <?php printf(__("You can follow any responses to this entry through the <a href='%s'>RSS 2.0</a> feed.", "kubrick"), get_post_comments_feed_link()); ?>

<!-- コメントとトラックバックが許可されている場合 *3 -->
                        <?php if (('open' == $post-> comment_status) && ('open' == $post->ping_status)) {
                            // Both Comments and Pings are open ?>
<!-- コメントフォームへのリンクとトラックバック URL を表示 -->
                            <?php printf(__('You can <a href="#respond">leave a response</a>, or <a href="%s" rel="trackback">trackback</a> from your own site.', 'kubrick'), trackback_url(false)); ?>

<!-- コメント不許可、トラックバック許可 *3' -->
                        <?php } elseif (!('open' == $post-> comment_status) && ('open' == $post->ping_status)) {
                            // Only Pings are Open ?>
<!-- コメントを受け付けないというメッセージとトラックバック URL を表示 -->
                            <?php printf(__('Responses are currently closed, but you can <a href="%s" rel="trackback">trackback</a> from your own site.', 'kubrick'), trackback_url(false)); ?>

<!-- コメント許可、トラックバック不許可 *3'' -->
                        <?php } elseif (('open' == $post-> comment_status) && !('open' == $post->ping_status)) {
                            // Comments are open, Pings are not ?>
<!-- コメントフォームへのリンクとトラックバックを受け付けないというメッセージを表示 -->
                            <?php _e('You can skip to the end and leave a response. Pinging is currently not allowed.', 'kubrick'); ?>

<!-- コメントもトラックバック不許可 *3''' -->
                        <?php } elseif (!('open' == $post-> comment_status) && !('open' == $post->ping_status)) {
                            // Neither Comments, nor Pings are open ?>
<!-- コメントとトラックバックを受け付けないというメッセージを表示 -->
                            <?php _e('Both comments and pings are currently closed.', 'kubrick'); ?>

<!-- if 文 *3 の終了 -->
<!-- edit_post_link() は 投稿を編集するためのリンクを表示する (ログイン中のみ) -->
                        <?php } edit_post_link(__('Edit this entry', 'kubrick'),'','.'); ?>

                    </small>
                </p>

            </div>
        </div>

<!-- コメントテンプレート表示 -->
    <?php comments_template(); ?>

<!-- *2 の終了 -->
<!-- *1 が成立しない場合 -->
    <?php endwhile; else: ?>

<!-- 記事が存在しない、と表示 -->
        <p><?php _e('Sorry, no posts matched your criteria.', 'kubrick'); ?></p>

<!-- *1 の終了 -->
<?php endif; ?>

    </div>

<!-- フッターを埋め込む -->
<?php get_footer(); ?>

WP2.7 のテンプレートです。最新版は次回セミナー参加者に配布予定です。

  Sign in   Recent Site Activity   Terms   Report Abuse   Print page  |  Powered by Google Sites