26. 26/111
01. <?php
02. /**
03. * The main template file.
04. *
05. * This is the most generic template file in a WordPress theme
06. * and one of the two required files for a theme (the other being style.css).
07. * It is used to display a page when nothing more specific matches a query.
08. * E.g., it puts together the home page when no home.php file exists.
09. * Learn more: http://codex.wordpress.org/Template_Hierarchy
10. *
11. * @package WordPress
12. * @subpackage Twenty_Ten
13. * @since Twenty Ten 1.0
14. */
15.
16. get_header(); ?>
17.
18. <div id="container">
19. <div id="content" role="main">
20.
index.php (1/2)
27. 27/111
21. <?php
22. /* Run the loop to output the posts.
23. * If you want to overload this in a child theme then include a file
24. * called loop-index.php and that will be used instead.
25. */
26. get_template_part( 'loop', 'index' );
27. ?>
28. </div><!-- #content -->
29. </div><!-- #container -->
30.
31. <?php get_sidebar(); ?>
32. <?php get_footer(); ?>
index.php (2/2)
26. get_template_part( 'loop', 'index' );26. get_template_part( 'loop', 'index' );
◆ テンプレートパーツの読み込み
31. 31/111
01. <?php
02. /**
03. * The Header for our theme.
04. *
05. * Displays all of the <head> section and everything up till <div id="main">
06. *
07. * @package WordPress
08. * @subpackage Twenty_Ten
09. * @since Twenty Ten 1.0
10. */
11. ?><!DOCTYPE html>
12. <html <?php language_attributes(); ?>>
13. <head>
14. <meta charset="<?php bloginfo( 'charset' ); ?>" />
15. <title><?php
16. /*
17. * Print the <title> tag based on what is being viewed.
18. */
19. global $page, $paged;
20.
21. wp_title( '|', true, 'right' );
header.php(1/5)
11. ?><!DOCTYPE html>
12. <html <?php language_attributes(); ?>>
13. <head>
14. <meta charset="<?php bloginfo( 'charset' ); ?>" /><meta charset="<?php bloginfo( 'charset' ); ?>" />
HTML5 !
32. 32/111
22.
23. // Add the blog name.
24. bloginfo( 'name' );
25.
26. // Add the blog description for the home/front page.
27. $site_description = get_bloginfo( 'description', 'display' );
28. if ( $site_description && ( is_home() || is_front_page() ) )
29. echo " | $site_description";
30.
31. // Add a page number if necessary:
32. if ( $paged >= 2 || $page >= 2 )
33. echo ' | ' . sprintf( __( 'Page %s', 'twentyten' ), max( $paged, $page ) );
34.
35. ?></title>
36. <link rel="profile" href="http://gmpg.org/xfn/11" />
37. <link rel="stylesheet" type="text/css" media="all" href="<?php bloginfo( 'stylesheet_
url' ); ?>" />
38. <link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" />
39. <?php
40. /* We add some JavaScript to pages with the comment form
41. * to support sites with threaded comments (when in use).
42. */
header.php(2/5)
31. // Add a page number if necessary:
32. if ( $paged >= 2 || $page >= 2 )
33. echo ' | ' . sprintf( __( 'Page %s', 'twentyten' ), max( $paged, $page ) );
26. // Add the blog description for the home/front page.
27. $site_description = get_bloginfo( 'description', 'display' );
28. if ( $site_description && ( is_home() || is_front_page() ) )
29. echo " | $site_description";echo " | $site_description";
トップページの場合は、サイトの
説明(キャッチフレーズ)を表示
2 ページ目以降はページ数を表示
33. 33/111
43. if ( is_singular() && get_option( 'thread_comments' ) )
44. wp_enqueue_script( 'comment-reply' );
45.
46. /* Always have wp_head() just before the closing </head>
47. * tag of your theme, or you will break many plugins, which
48. * generally use this hook to add elements to <head> such
49. * as styles, scripts, and meta tags.
50. */
51. wp_head();
52. ?>
53. </head>
54.
55. <body <?php body_class(); ?>>
56. <div id="wrapper" class="hfeed">
57.
58. <div id="header">
59. <div id="masthead">
60. <div id="branding" role="banner">
61. <?php $heading_tag = ( is_home() || is_front_page() ) ? 'h1' : 'div'; ?>
62. <<?php echo $heading_tag; ?> id="site-title">
63. <span>
64. <a href="<?php echo home_url( '/' ); ?>" title="<?php echo
header.php(3/5)
61. <?php $heading_tag = ( is_home() || is_front_page() ) ? 'h1' : 'div'; ?>
62. <<?php echo $heading_tag; ?> id="site-title">
61.
62. <<?php echo $heading_tag; ?> id="site-title">
サイトタイトルを括るタグがページに
よって変化
トップページ:h1 タグ
その他のページ:div タグ
44. wp_enqueue_script( 'comment-reply' );
javascript を適切な順番でロードしてくれる
便利関数。
51. wp_head();51.
ヘッダの終わりを通知するフック。プラグインや
独自関数で使用。これを消すと、正常に動作しな
くなるプラグインやテーマが出てくる
34. 34/111
esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home"><?php bloginfo( 'name' );
?></a>
65. </span>
66. </<?php echo $heading_tag; ?>>
67. <div id="site-description"><?php bloginfo( 'description' ); ?></div>
68.
69. <?php
70. // Check if this is a post or page, if it has a thumbnail, and if it's a
big one
71. if ( is_singular() &&
72. has_post_thumbnail( $post->ID ) &&
73. ( /* $src, $width, $height */ $image = wp_get_attachment_
image_src( get_post_thumbnail_id( $post->ID ), 'post-thumbnail' ) ) &&
74. $image[1] >= HEADER_IMAGE_WIDTH ) :
75. // Houston, we have a new header image!
76. echo get_the_post_thumbnail( $post->ID, 'post-thumbnail' );
77. else : ?>
78. <img src="<?php header_image(); ?>" width="<?php echo
HEADER_IMAGE_WIDTH; ?>" height="<?php echo HEADER_IMAGE_HEIGHT; ?>"
alt="" />
79. <?php endif; ?>
80. </div><!-- #branding -->
header.php(4/5)
69. <?php
70. // Check if this is a post or page, if it has a thumbnail, and if it's a
big one
71. if ( is_singular() &&
72. has_post_thumbnail( $post->ID ) &&
73. ( /* $src, $width, $height */ $image = wp_get_attachment_
image_src( get_post_thumbnail_id( $post->ID ), 'post-thumbnail' ) ) &&
74. $image[1] >= HEADER_IMAGE_WIDTH ) :
75. // Houston, we have a new header image!
76. echo get_the_post_thumbnail( $post->ID, 'post-thumbnail' );
77. else : ?>
78. <img src="<?php header_image(); ?>" width="<?php echo
HEADER_IMAGE_WIDTH; ?>" height="<?php echo HEADER_IMAGE_HEIGHT; ?>"
alt="" />
79. <?php endif; ?>
69.
70.
71.
72.
73. ( /* $src, $width, $height */ $image = wp_get_attachment_
74.
75.
76.
77.
78.
79.
◆ ページによってヘッダ画像の変更
35. 35/111
81.
82. <div id="access" role="navigation">
83. <?php /* Allow screen readers / text browsers to skip the navigation
menu and get right to the good stuff */ ?>
84. <div class="skip-link screen-reader-text"><a href="#content"
title="<?php esc_attr_e( 'Skip to content', 'twentyten' ); ?>"><?php _e( 'Skip to
content', 'twentyten' ); ?></a></div>
85. <?php /* Our navigation menu. If one isn't filled out, wp_nav_menu
falls back to wp_page_menu. The menu assiged to the primary position is the one
used. If none is assigned, the menu with the lowest ID is used. */ ?>
86. <?php wp_nav_menu( array( 'container_class' => 'menu-header',
'theme_location' => 'primary' ) ); ?>
87. </div><!-- #access -->
88. </div><!-- #masthead -->
89. </div><!-- #header -->
90.
91. <div id="main">
header.php(5/5)
83. <?php /* Allow screen readers / text browsers to skip the navigation
menu and get right to the good stuff */ ?>
84. <div class="skip-link screen-reader-text"><a href="#content"
title="<?php esc_attr_e( 'Skip to content', 'twentyten' ); ?>"><?php _e( 'Skip to
content', 'twentyten' ); ?></a></div>
<?php /* Allow screen readers / text browsers to skip the navigation
<div class="skip-link screen-reader-text"><a href="#content"
title="<?php esc_attr_e( 'Skip to content', 'twentyten' ); ?>"><?php _e( 'Skip to
content', 'twentyten' ); ?></a></div>
85. <?php /* Our navigation menu. If one isn't filled out, wp_nav_menu
falls back to wp_page_menu. The menu assiged to the primary position is the one
used. If none is assigned, the menu with the lowest ID is used. */ ?>
86. <?php wp_nav_menu( array( 'container_class' => 'menu-header',
'theme_location' => 'primary' ) ); ?>
<?php /* Our navigation menu. If one isn't filled out, wp_nav_menu
falls back to wp_page_menu. The menu assiged to the primary position is the one
<?php wp_nav_menu( array( 'container_class' => 'menu-header',
'theme_location' => 'primary' ) ); ?>
スクリーンリーダのスキップ対応
◆ ナビゲーションメニュー表示
36. 36/111
<?php
// Check if this is a post or page, if it has a thumbnail, and if it's a big one
if ( is_singular() &&
has_post_thumbnail( $post->ID ) &&
( /* $src, $width, $height */ $image = wp_get_attachment_image_src( get_post_
thumbnail_id( $post->ID ), 'post-thumbnail' ) ) &&
$image[1] >= HEADER_IMAGE_WIDTH ) :
// Houston, we have a new header image!
echo get_the_post_thumbnail( $post->ID, 'post-thumbnail' );
else : ?>
<img src="<?php header_image(); ?>" width="<?php echo HEADER_IMAGE_WIDTH;
?>" height="<?php echo HEADER_IMAGE_HEIGHT; ?>" alt="" />
<?php endif; ?>
ページによってヘッダ画像の変更(1)
if ( is_singular() &&
has_post_thumbnail( $post->ID ) &&
( /* $src, $width, $height */ $image = wp_get_attachment_image_src( get_post_
thumbnail_id( $post->ID ), 'post-thumbnail' ) ) &&
$image[1] >= HEADER_IMAGE_WIDTH ) :
// Houston, we have a new header image!
echo get_the_post_thumbnail( $post->ID, 'post-thumbnail' );
if ( is_singular() &&
has_post_thumbnail( $post->ID ) &&
( /* $src, $width, $height */ $image = wp_get_attachment_image_src( get_post_
$image[1] >= HEADER_IMAGE_WIDTH ) :
// Houston, we have a new header image!
echo get_the_post_thumbnail( $post->ID, 'post-thumbnail' );
以下の条件がそろってる場合は、投稿サムネイル表示
・単独ページ
・投稿サムネイル(アイキャッチ)画像が指定してある
・投稿サムネイル画像の幅が指定サイズ(940px)以上
else : ?>
<img src="<?php header_image(); ?>" width="<?php echo HEADER_IMAGE_WIDTH;
?>" height="<?php echo HEADER_IMAGE_HEIGHT; ?>" alt="" />
<?php endif; ?>
else : ?>
<img src="<?php header_image(); ?>" width="<?php echo HEADER_IMAGE_WIDTH;
<?php endif; ?>
条件がそろっていない場合は、管理画面で指定したカ
スタムヘッダー画像を表示
41. 41/111
01. <?php
02. /**
03. * The loop that displays posts.
04. *
05. * The loop displays the posts and the post content. See
06. * http://codex.wordpress.org/The_Loop to understand it and
07. * http://codex.wordpress.org/Template_Tags to understand
08. * the tags used in it.
09. *
10. * This can be overridden in child themes with loop.php or
11. * loop-template.php, where 'template' is the loop context
12. * requested by a template. For example, loop-index.php would
13. * be used if it exists and we ask for the loop with:
14. * <code>get_template_part( 'loop', 'index' );</code>
15. *
16. * @package WordPress
17. * @subpackage Twenty_Ten
18. * @since Twenty Ten 1.0
19. */
20. ?>
21.
loop.php(1/10)
42. 42/111
22. <?php /* Display navigation to next/previous pages when applicable */ ?>
23. <?php if ( $wp_query->max_num_pages > 1 ) : ?>
24. <div id="nav-above" class="navigation">
25. <div class="nav-previous"><?php next_posts_link( __( '<span class="meta-
nav">←</span> Older posts', 'twentyten' ) ); ?></div>
26. <div class="nav-next"><?php previous_posts_link( __( 'Newer posts <span
class="meta-nav">→</span>', 'twentyten' ) ); ?></div>
27. </div><!-- #nav-above -->
28. <?php endif; ?>
29.
30. <?php /* If there are no posts to display, such as an empty archive page */ ?>
31. <?php if ( ! have_posts() ) : ?>
32. <div id="post-0" class="post error404 not-found">
33. <h1 class="entry-title"><?php _e( 'Not Found', 'twentyten' ); ?></h1>
34. <div class="entry-content">
35. <p><?php _e( 'Apologies, but no results were found for the requested
archive. Perhaps searching will help find a related post.', 'twentyten' ); ?></p>
36. <?php get_search_form(); ?>
37. </div><!-- .entry-content -->
38. </div><!-- #post-0 -->
39. <?php endif; ?>
40.
loop.php(2/10)
22. <?php /* Display navigation to next/previous pages when applicable */ ?>
23. <?php if ( $wp_query->max_num_pages > 1 ) : ?>
24. <div id="nav-above" class="navigation">
25. <div class="nav-previous"><?php next_posts_link( __( '<span class="meta-
nav">←</span> Older posts', 'twentyten' ) ); ?></div>
26. <div class="nav-next"><?php previous_posts_link( __( 'Newer posts <span
class="meta-nav">→</span>', 'twentyten' ) ); ?></div>
27. </div><!-- #nav-above -->
28. <?php endif; ?>
<div class="nav-next"><?php previous_posts_link( __( 'Newer posts <span
1 ページ以上ある場合ナビゲーショ
ンリンク表示(空タグ対策用?)
43. 43/111
41. <?php
42. /* Start the Loop.
43. *
44. * In Twenty Ten we use the same loop in multiple contexts.
45. * It is broken into three main parts: when we're displaying
46. * posts that are in the gallery category, when we're displaying
47. * posts in the asides category, and finally all other posts.
48. *
49. * Additionally, we sometimes check for whether we are on an
50. * archive page, a search page, etc., allowing for small differences
51. * in the loop on each template without actually duplicating
52. * the rest of the loop that is shared.
53. *
54. * Without further ado, the loop:
55. */ ?>
56. <?php while ( have_posts() ) : the_post(); ?>
57.
58. <?php /* How to display posts in the Gallery category. */ ?>
59.
60. <?php if ( in_category( _x('gallery', 'gallery category slug', 'twentyten') ) ) : ?>
61. <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
62. <h2 class="entry-title"><a href="<?php the_permalink(); ?>" title="<?php
loop.php(3/10)
41. <?php
42. /* Start the Loop.
43. *
44. * In Twenty Ten we use the same loop in multiple contexts.
45. * It is broken into three main parts: when we're displaying
46. * posts that are in the gallery category, when we're displaying
47. * posts in the asides category, and finally all other posts.
48. *
49. * Additionally, we sometimes check for whether we are on an
50. * archive page, a search page, etc., allowing for small differences
51. * in the loop on each template without actually duplicating
52. * the rest of the loop that is shared.
53. *
54. * Without further ado, the loop:
55. */ ?>
56. <?php while ( have_posts() ) : the_post(); ?>
41.
42.
43.
44.
45.
46.
47.
48.
49.
投稿ループ開始
カテゴリの種類によって表示方法変更
・gallery
・asides
・それ以外のカテゴリー
カテゴリー名かカテゴリースラッグ
名が gallery の場合の投稿表示開始
58. <?php /* How to display posts in the Gallery category. */ ?>
59.
60. <?php if ( in_category( _x('gallery', 'gallery category slug', 'twentyten') ) ) : ?>
58.
59.
60.
50. 50/111
165.
166. <?php endif; // This was the if statement that broke the loop into three parts
based on categories. ?>
167.
168. <?php endwhile; // End the loop. Whew. ?>
169.
170. <?php /* Display navigation to next/previous pages when applicable */ ?>
171. <?php if ( $wp_query->max_num_pages > 1 ) : ?>
172. <div id="nav-below" class="navigation">
173. <div class="nav-previous"><?php next_posts_link( __( '<span
class="meta-nav">←</span> Older posts', 'twentyten' ) ); ?></div>
174. <div class="nav-next"><?php previous_posts_link( __( 'Newer
posts <span class="meta-nav">→</span>', 'twentyten' ) ); ?></div>
175. </div><!-- #nav-below -->
176. <?php endif; ?>
loop.php(10/10)
166. <?php endif; // This was the if statement that broke the loop into three parts
based on categories. ?>
<?php endif; // This was the if statement that broke the loop into three parts
based on categories. ?>
投稿表示の分岐終わり
53. 53/111
01. <?php
02. /**
03. * The Sidebar containing the primary and secondary widget areas.
04. *
05. * @package WordPress
06. * @subpackage Twenty_Ten
07. * @since Twenty Ten 1.0
08. */
09. ?>
10.
11. <div id="primary" class="widget-area" role="complementary">
12. <ul class="xoxo">
13.
14. <?php
15. /* When we call the dynamic_sidebar() function, it'll spit out
16. * the widgets for that widget area. If it instead returns false,
17. * then the sidebar simply doesn't exist, so we'll hard-code in
18. * some default sidebar stuff just in case.
19. */
20. if ( ! dynamic_sidebar( 'primary-widget-area' ) ) : ?>
21.
sidebar.php(1/3)
14. <?php
15. /* When we call the dynamic_sidebar() function, it'll spit out
16. * the widgets for that widget area. If it instead returns false,
17. * then the sidebar simply doesn't exist, so we'll hard-code in
18. * some default sidebar stuff just in case.
19. */
20. if ( ! dynamic_sidebar( 'primary-widget-area' ) ) : ?>
14. <?php
15.
16.
17.
18.
19.
20. if ( ! dynamic_sidebar( 'primary-widget-area' ) ) : ?>
◆ ウィジェット 1 の表示
58. 58/111
01. <?php
02. /**
03. * The template for displaying the footer.
04. *
05. * Contains the closing of the id=main div and all content
06. * after. Calls sidebar-footer.php for bottom widgets.
07. *
08. * @package WordPress
09. * @subpackage Twenty_Ten
10. * @since Twenty Ten 1.0
11. */
12. ?>
13. </div><!-- #main -->
14.
15. <div id="footer" role="contentinfo">
16. <div id="colophon">
17.
18. <?php
19. /* A sidebar in the footer? Yep. You can can customize
20. * your footer with four columns of widgets.
21. */
22. get_sidebar( 'footer' );
footer.php(1/3)
18. <?php
19. /* A sidebar in the footer? Yep. You can can customize
20. * your footer with four columns of widgets.
21. */
22. get_sidebar( 'footer' );
18. <?php
sidebar-footer.php 読み込み
60. 60/111
41.
42. </div><!-- #wrapper -->
43.
44. <?php
45. /* Always have wp_footer() just before the closing </body>
46. * tag of your theme, or you will break many plugins, which
47. * generally use this hook to reference JavaScript files.
48. */
49.
50. wp_footer();
51. ?>
52. </body>
53. </html>
footer.php(3/3)
50. wp_footer();50.
フッタの終わりを通知するフック。プラグインや
独自関数で使用。これを消すと、正常に動作しな
くなるプラグインやテーマが出てくる
62. 62/111
01. <?php
02. /**
03. * The Footer widget areas.
04. *
05. * @package WordPress
06. * @subpackage Twenty_Ten
07. * @since Twenty Ten 1.0
08. */
09. ?>
10.
11. <?php
12. /* The footer widget area is triggered if any of the areas
13. * have widgets. So let's check that first.
14. *
15. * If none of the sidebars have widgets, then let's bail early.
16. */
17. if ( ! is_active_sidebar( 'first-footer-widget-area' )
18. && ! is_active_sidebar( 'second-footer-widget-area' )
19. && ! is_active_sidebar( 'third-footer-widget-area' )
20. && ! is_active_sidebar( 'fourth-footer-widget-area' )
21. )
22. return;
sidebar-footer.php(1/3)
11. <?php
12. /* The footer widget area is triggered if any of the areas
13. * have widgets. So let's check that first.
14. *
15. * If none of the sidebars have widgets, then let's bail early.
16. */
17. if ( ! is_active_sidebar( 'first-footer-widget-area' )
18. && ! is_active_sidebar( 'second-footer-widget-area' )
19. && ! is_active_sidebar( 'third-footer-widget-area' )
20. && ! is_active_sidebar( 'fourth-footer-widget-area' )
21. )
22. return;
フッターウィジェットエリアが全て設定
されていない場合は何もしない
71. 71/111
01. <?php
02. /**
03. * The template for displaying Comments.
04. *
05. * The area of the page that contains both current comments
06. * and the comment form. The actual display of comments is
07. * handled by a callback to twentyten_comment which is
08. * located in the functions.php file.
09. *
10. * @package WordPress
11. * @subpackage Twenty_Ten
12. * @since Twenty Ten 1.0
13. */
14. ?>
15.
16. <div id="comments">
17. <?php if ( post_password_required() ) : ?>
18. <p class="nopassword"><?php _e( 'This post is password protected.
Enter the password to view any comments.', 'twentyten' ); ?></p>
19. </div><!-- #comments -->
comments.php (1/4)
72. 72/111
20. <?php
21. /* Stop the rest of comments.php from being processed,
22. * but don't kill the script entirely -- we still have
23. * to fully load the template.
24. */
25. return;
26. endif;
27. ?>
28.
29. <?php
30. // You can start editing here -- including this comment!
31. ?>
32.
33. <?php if ( have_comments() ) : ?>
34. <h3 id="comments-title"><?php
35. printf( _n( 'One Response to %2$s', '%1$s Responses to %2$s', get_
comments_number(), 'twentyten' ),
36. number_format_i18n( get_comments_number() ), '<em>' . get_the_title()
. '</em>' );
37. ?></h3>
38.
39. <?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : //
Are there comments to navigate through? ?>
comments.php (2/4)
73. 73/111
40. <div class="navigation">
41. <div class="nav-previous"><?php previous_comments_link( __( '<span
class="meta-nav">←</span> Older Comments', 'twentyten' ) ); ?></div>
42. <div class="nav-next"><?php next_comments_link( __( 'Newer
Comments <span class="meta-nav">→</span>', 'twentyten' ) ); ?></div>
43. </div> <!-- .navigation -->
44. <?php endif; // check for comment navigation ?>
45.
46. <ol class="commentlist">
47. <?php
48. /* Loop through and list the comments. Tell wp_list_comments()
49. * to use twentyten_comment() to format the comments.
50. * If you want to overload this in a child theme then you can
51. * define twentyten_comment() and that will be used instead.
52. * See twentyten_comment() in twentyten/functions.php for more.
53. */
54. wp_list_comments( array( 'callback' => 'twentyten_comment' ) );
55. ?>
56. </ol>
57.
58. <?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : //
Are there comments to navigate through? ?>
59. <div class="navigation">
comments.php (3/4)
58. <?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : //
Are there comments to navigate through? ?>
58.
コメント一覧表示のカスタマイズ指定
functions.php(288-340 行)で定義
54. wp_list_comments( array( 'callback' => 'twentyten_comment' ) );
コメントのページが 2 ページ以上の場
合は前後のナビゲーション表示
74. 74/111
60. <div class="nav-previous"><?php previous_comments_link( __( '<span
class="meta-nav">←</span> Older Comments', 'twentyten' ) ); ?></div>
61. <div class="nav-next"><?php next_comments_link( __( 'Newer
Comments <span class="meta-nav">→</span>', 'twentyten' ) ); ?></div>
62. </div><!-- .navigation -->
63. <?php endif; // check for comment navigation ?>
64.
65. <?php else : // or, if we don't have comments:
66.
67. /* If there are no comments and comments are closed,
68. * let's leave a little note, shall we?
69. */
70. if ( ! comments_open() ) :
71. ?>
72. <p class="nocomments"><?php _e( 'Comments are closed.', 'twentyten' ); ?></
p>
73. <?php endif; // end ! comments_open() ?>
74.
75. <?php endif; // end have_comments() ?>
76.
77. <?php comment_form(); ?>
78.
79. </div><!-- #comments -->
comments.php (4/4)
77. <?php comment_form(); ?>
コメントフォームを読み込む
76. 76/111
01. <?php
02. /**
03. * The template for displaying all pages.
04. *
05. * This is the template that displays all pages by default.
06. * Please note that this is the WordPress construct of pages
07. * and that other 'pages' on your WordPress site will use a
08. * different template.
09. *
10. * @package WordPress
11. * @subpackage Twenty_Ten
12. * @since Twenty Ten 1.0
13. */
14.
15. get_header(); ?>
16.
17. <div id="container">
18. <div id="content" role="main">
page.php (1/3)
86. 86/111
01. <?php
02. /**
03. * The template for displaying Archive pages.
04. *
05. * Used to display archive-type pages if nothing more specific matches a query.
06. * For example, puts together date-based pages if no date.php file exists.
07. *
08. * Learn more: http://codex.wordpress.org/Template_Hierarchy
09. *
10. * @package WordPress
11. * @subpackage Twenty_Ten
12. * @since Twenty Ten 1.0
13. */
14.
15. get_header(); ?>
16.
17. <div id="container">
18. <div id="content" role="main">
19.
archive.php (1/3)
87. 87/111
20. <?php
21. /* Queue the first post, that way we know
22. * what date we're dealing with (if that is the case).
23. *
24. * We reset this later so we can run the loop
25. * properly with a call to rewind_posts().
26. */
27. if ( have_posts() )
28. the_post();
29. ?>
30.
31. <h1 class="page-title">
32. <?php if ( is_day() ) : ?>
33. <?php printf( __( 'Daily Archives: <span>%s</span>', 'twentyten' ),
get_the_date() ); ?>
34. <?php elseif ( is_month() ) : ?>
35. <?php printf( __( 'Monthly Archives: <span>%s</span>', 'twentyten' ),
get_the_date('F Y') ); ?>
36. <?php elseif ( is_year() ) : ?>
37. <?php printf( __( 'Yearly Archives: <span>%s</span>', 'twentyten' ),
get_the_date('Y') ); ?>
38. <?php else : ?>
39. <?php _e( 'Blog Archives', 'twentyten' ); ?>
archive.php (1/3)
27. if ( have_posts() )
28. the_post();the_post();
投稿がある場合は、年月日を取得するために、
最初の投稿データをセットする。
32. <?php if ( is_day() ) : ?>
33. <?php printf( __( 'Daily Archives: <span>%s</span>', 'twentyten' ),
get_the_date() ); ?>
34. <?php elseif ( is_month() ) : ?>
35. <?php printf( __( 'Monthly Archives: <span>%s</span>', 'twentyten' ),
get_the_date('F Y') ); ?>
36. <?php elseif ( is_year() ) : ?>
37. <?php printf( __( 'Yearly Archives: <span>%s</span>', 'twentyten' ),
get_the_date('Y') ); ?>
38. <?php else : ?>
39. <?php _e( 'Blog Archives', 'twentyten' ); ?>
<?php printf( __( 'Daily Archives: <span>%s</span>', 'twentyten' ),
<?php printf( __( 'Monthly Archives: <span>%s</span>', 'twentyten' ),
<?php printf( __( 'Yearly Archives: <span>%s</span>', 'twentyten' ),
<?php _e( 'Blog Archives', 'twentyten' ); ?>
年月日のページ別でタイトルを変える
88. 88/111
40. <?php endif; ?>
41. </h1>
42.
43. <?php
44. /* Since we called the_post() above, we need to
45. * rewind the loop back to the beginning that way
46. * we can run the loop properly, in full.
47. */
48. rewind_posts();
49.
50. /* Run the loop for the archives page to output the posts.
51. * If you want to overload this in a child theme then include a file
52. * called loop-archives.php and that will be used instead.
53. */
54. get_template_part( 'loop', 'archive' );
55. ?>
56.
57. </div><!-- #content -->
58. </div><!-- #container -->
59.
60. <?php get_sidebar(); ?>
61. <?php get_footer(); ?>
archive.php (1/3)
48. rewind_posts();48. rewind_posts();
loop-archive.php が同じテーマ内か子テー
マにある場合はそれを読み込む。
ない場合は、loop.php を読み込む
54. get_template_part( 'loop', 'archive' );
一度に the_post を呼んでいるため、ループカウンタのリセッ
トをする
91. 91/111
18. <?php
19. $category_description = category_description();
20. if ( ! empty( $category_description ) )
21. echo '<div class="archive-meta">' . $category_description . '</
div>';
22.
23. /* Run the loop for the category page to output the posts.
24. * If you want to overload this in a child theme then include a file
25. * called loop-category.php and that will be used instead.
26. */
27. get_template_part( 'loop', 'category' );
28. ?>
29.
30. </div><!-- #content -->
31. </div><!-- #container -->
32.
33. <?php get_sidebar(); ?>
34. <?php get_footer(); ?>
category.php (2/2)
loop-category.php が同じテーマ内か子テー
マにある場合はそれを読み込む。
ない場合は、loop.php を読み込む
27. get_template_part( 'loop', 'category' );get_template_part( 'loop', 'category' );
94. 94/111
18.
19. <?php
20. /* Run the loop for the tag archive to output the posts
21. * If you want to overload this in a child theme then include a file
22. * called loop-tag.php and that will be used instead.
23. */
24. get_template_part( 'loop', 'tag' );
25. ?>
26. </div><!-- #content -->
27. </div><!-- #container -->
28.
29. <?php get_sidebar(); ?>
30. <?php get_footer(); ?>
tag.php (2/2)
loop-tag.php が同じテーマ内か子テーマに
ある場合はそれを読み込む。
ない場合は、loop.php を読み込む
24. get_template_part( 'loop', 'tag' );
96. 96/111
01. <?php
02. /**
03. * The template for displaying Author Archive pages.
04. *
05. * @package WordPress
06. * @subpackage Twenty_Ten
07. * @since Twenty Ten 1.0
08. */
09.
10. get_header(); ?>
11.
12. <div id="container">
13. <div id="content" role="main">
14.
15. <?php
16. /* Queue the first post, that way we know who
17. * the author is when we try to get their name,
18. * URL, description, avatar, etc.
19. *
20. * We reset this later so we can run the loop
21. * properly with a call to rewind_posts().
22. */
auther.php (1/3)
98. 98/111
41. <?php endif; ?>
42.
43. <?php
44. /* Since we called the_post() above, we need to
45. * rewind the loop back to the beginning that way
46. * we can run the loop properly, in full.
47. */
48. rewind_posts();
49.
50. /* Run the loop for the author archive page to output the authors posts
51. * If you want to overload this in a child theme then include a file
52. * called loop-author.php and that will be used instead.
53. */
54. get_template_part( 'loop', 'author' );
55. ?>
56. </div><!-- #content -->
57. </div><!-- #container -->
58.
59. <?php get_sidebar(); ?>
60. <?php get_footer(); ?>
loop-author.php が同じテーマ内か子テーマ
にある場合はそれを読み込む。
ない場合は、loop.php を読み込む
54. get_template_part( 'loop', 'author' );
auther.php (3/3)
48. rewind_posts();
一度に the_post を呼んでいるため、ループカウンタのリセッ
トをする