More Related Content Similar to Wordpressで自分好みのテーマを作る
Similar to Wordpressで自分好みのテーマを作る (20) More from Takashi Uemura (13) Wordpressで自分好みのテーマを作る4. 軽く自己紹介
しがないフリーランスSE
組込みエンジニア(カーナビ)
5. 軽く自己紹介
しがないフリーランスSE
組込みエンジニア(カーナビ)
副業で少しWeb
32. テーマは2つ ※WordPress 2.x での話
themes
36. index.html
<html>
<head>
<title>文書のタイトル</title>
</head>
<body>
文書の本文
</body>
</html>
40. index.php
<?php
$title = "文書のタイトル";
$contents = "文書の本文";
?>
<html>
<head>
<title><?php echo $title ?></title>
</head>
<body>
<?php echo $contents ?>
</body>
</html>
47. index.php
<?php get_header(); ?>
<?php while (have_posts()) : the_post(); ?>
<?php endwhile; ?>
<?php get_sidebar(); ?> WordPressループ
<?php get_footer(); ?> (Main Contents)
※WordPress3ではloop.php内にあり
48. index.php
<?php get_header(); ?>
<?php while (have_posts()) : the_post(); ?>
<?php endwhile; ?>
header
<?php get_sidebar(); ?>
<?php get_footer(); ?>
main side
contents bar
footer
49. index.php
<?php get_header(); ?>
<?php while (have_posts()) : the_post(); ?>
<?php endwhile; ?>
header
<?php get_sidebar(); ?>
<?php get_footer(); ?>
main side
contents bar
footer
50. index.php
<?php get_header(); ?>
<?php while (have_posts()) : the_post(); ?>
<?php endwhile; ?>
header
<?php get_sidebar(); ?>
<?php get_footer(); ?>
main Side
contents bar
footer
51. index.php
<?php get_header(); ?>
<?php while (have_posts()) : the_post(); ?>
<?php endwhile; ?>
header
<?php get_sidebar(); ?>
<?php get_footer(); ?>
main side
contents bar
footer
52. index.php
<?php get_header(); ?>
<?php while (have_posts()) : the_post(); ?>
<?php endwhile; ?>
<?php get_sidebar(); ?>
<?php get_footer(); ?>
テンプレートタグ
WordPress組込の関数
53. index.php
<?php get_header(); ?> header.php
<?php while (have_posts()) : the_post(); ?>
<?php endwhile; ?>
<?php get_sidebar(); ?> sidebar.php
<?php get_footer(); ?>
footer.php
57. header.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtm
<html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>>
<head>
<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginf
<title>
<?php wp_title('«', true, 'right'); ?>
<?php bloginfo('name'); ?>
</title>
<link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css” />
<style type="text/css”>
#page { background: url("<?php bloginfo('stylesheet_directory'); ?>/images/kubrickbg-ltr.jpg“) }
</style>
<?php wp_head(); ?>
</head>
<body>
<div id="page">
<div id="header" role="banner">
<div id="headerimg">
<h1><a href="<?php echo get_option('home'); ?>/"><?php bloginfo('name'); ?></a>
<div class="description"><?php bloginfo('description'); ?></div>
</div>
</div>
58. header.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtm
<html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>>
<head>
<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginf
<title>
<?php wp_title('«', true, 'right'); ?>
<?php bloginfo('name'); ?>
</title>
<link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css” />
<style type="text/css”>
#page { background: url("<?php bloginfo('stylesheet_directory'); ?>/images/kubrickbg-ltr.jpg“) }
</style>
<?php wp_head(); ?>
</head>
<body>
URL タイトル
<div id="page">
<div id="header" role="banner">
<div id="headerimg">
<h1><a href="<?php echo get_option('home'); ?>/"><?php bloginfo('name'); ?></a>
<div class="description"><?php bloginfo('description'); ?></div>
</div>
</div> サイトの説明
60. header.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtm
bloginfoの
<html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>>
<head>
マニュアルを見てみる bloginfo('html_type'); ?>; charset=<?php bloginf
<meta http-equiv="Content-Type" content="<?php
<title>
<?php wp_title('«', true, 'right'); ?>
<?php bloginfo('name'); ?>
</title>
<link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css” />
<style type="text/css”>
#page { background: url("<?php bloginfo('stylesheet_directory'); ?>/images/kubrickbg-ltr.jpg“) }
</style>
<?php wp_head(); ?>
</head>
<body>
<div id="page">
<div id="header" role="banner">
<div id="headerimg">
<h1><a href="<?php echo get_option('home'); ?>/"><?php bloginfo('name'); ?></a>
<div class="description"><?php bloginfo('description'); ?></div>
</div>
</div>
61. header.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtm
ドキュメントの場所は?
<html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>>
<head>
<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginf
<title>
<?php wp_title('«', true, 'right'); ?>
<?php bloginfo('name'); ?>
</title>
<link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css” />
<style type="text/css”>
#page { background: url("<?php bloginfo('stylesheet_directory'); ?>/images/kubrickbg-ltr.jpg“) }
</style>
<?php wp_head(); ?>
</head>
<body>
<div id="page">
<div id="header" role="banner">
<div id="headerimg">
<h1><a href="<?php echo get_option('home'); ?>/"><?php bloginfo('name'); ?></a>
<div class="description"><?php bloginfo('description'); ?></div>
</div>
</div>
64. index.php(or loop.php)
<?php get_header(); ?> WordPressループ
(Main Contents)
<?php while (have_posts()) : the_post(); ?>
<?php endwhile; ?>
header
<?php get_sidebar(); ?>
<?php get_footer(); ?>
main side
contents bar
footer
65. 繰り返し
記事タイトル
日付
本文
カテゴリ、コメント
66. WordPressループ
<?php while (have_posts()) : the_post(); ?>
<div <?php post_class(); ?> id="post-<?php the_ID(); ?>">
<h2><a href="<?php the_permalink() ?>“ ><?php the_title(); ?></a></h2>
<small><?php the_time(__('F jS, Y', 'kubrick')) ?></small>
<div class="entry">
<?php the_content(__('Read the rest of this entry »', 'kubrick')); ?>
</div>
<p class="postmetadata">
<?php printf(__('Posted in %s', 'kubrick'), get_the_category_list(', ')); ?> |
<?php edit_post_link(__('Edit', 'kubrick'), '', ' | '); ?>
<?php comments_popup_link (__('No Comments »', 'kubrick'),
__('1 Comment »', 'kubrick'), __('% Comments »', 'kubrick'), '',
__('Comments Closed', 'kubrick') ); ?>
</p>
</div>
<?php endwhile; ?>
67. WordPressループ
<?php while (have_posts()) : the_post(); ?>
<div <?php post_class(); ?> id="post-<?php the_ID(); ?>">
<h2><a href="<?php the_permalink() ?>“ ><?php the_title(); ?></a></h2>
投稿がある間Loopする
<small><?php the_time(__('F jS, Y', 投稿1つ分の準備
'kubrick')) ?></small>
<div class="entry">
<?php the_content(__('Read the rest of this entry »', 'kubrick')); ?>
</div>
投稿の数だけループ
<p class="postmetadata">
<?php printf(__('Posted in %s', 'kubrick'), get_the_category_list(', ')); ?> |
<?php edit_post_link(__('Edit', 'kubrick'), '', ' | '); ?>
<?php comments_popup_link (__('No Comments »', 'kubrick'),
__('1 Comment »', 'kubrick'), __('% Comments »', 'kubrick'), '',
__('Comments Closed', 'kubrick') ); ?>
</p>
</div>
<?php endwhile; ?>
68. WordPressループ
<?php while (have_posts()) : the_post(); ?>
<div <?php post_class(); ?> id="post-<?php the_ID(); ?>"> タイトル
<h2><a href="<?php the_permalink() ?>“ ><?php the_title(); ?></a></h2>
<small><?php the_time(__('F jS, Y', 'kubrick')) ?></small>
<div class="entry">
<?php the_content(__('Read the rest of this entry »', 'kubrick')); ?>
</div>
<p class="postmetadata"> 本文
<?php printf(__('Posted in %s', 'kubrick'), get_the_category_list(', ')); ?> |
<?php edit_post_link(__('Edit', 'kubrick'), '', ' | '); ?>
<?php comments_popup_link (__('No Comments »', 'kubrick'),
__('1 Comment »', 'kubrick'), __('% Comments »', 'kubrick'), '',
__('Comments Closed', 'kubrick') ); ?>
</p>
</div>
<?php endwhile; ?>
69. <?php while (have_posts()) : the_post(); ?>
全部理解
<div <?php post_class(); ?> id="post-<?php the_ID(); ?>"> タイトル
<h2><a href="<?php the_permalink() ?>“ ><?php the_title(); ?></a></h2>
the_time
しないと
<small><?php (__('F jS, Y', 'kubrick')) ?></small>
<div class="entry">
the_content
<?php (__('Read the rest of this entry »', 'kubrick')); ?>
いけないの?
</div>
本文
<p class="postmetadata">
get_the_category_list
<?php printf(__('Posted in %s', 'kubrick'), (', ')); ?> |
<?php edit_post_link(__('Edit', 'kubrick'), '', ' | '); ?>
<?php comments_popup_link (__('No Comments »', 'kubrick'),
__('1 Comment »', 'kubrick'), __('% Comments »', 'kubrick'), '',
__('Comments Closed', 'kubrick') ); ?>
</p>
</div>
<?php endwhile; ?>
72. ← not foundページ
アーカイブページ
コメントページ
← 共通関数用
← 画像一覧ページ
default
言語関連ファイル
← リンクページ
← 特定の1ページ
← スクリーンショット
← 検索ページ
← 1投稿分の詳細ページ
73. ← not foundページ
アーカイブページ
コメントページ
← 共通関数用
← 画像一覧ページ
あとは調べれればなんとかなる!
default
言語関連ファイル
← リンクページ
← 特定の1ページ
← スクリーンショット
← 検索ページ
← 1投稿分の詳細ページ