初期設定

themeフォルダ内にカスタマイズしたいテーマ名のフォルダを作成。

style.cssの文頭に以下のように記述

/*
Theme Name: webタイトル
Theme URI: webURL
Description: サイトの説明
*/

head内設定とヘッダー部分を作成。

index.phpのhead内を記述。
metaタグ内にコンテンツとエンコードを指定。titleタグ内にタイトルを指定。

content="<?php bloginfo('html_type'); ?>  //コンテンツタイプ
charset=<?php bloginfo('charset'); ?>  //エンコードタイプ
<meta charset="UTF-8">
<title><?php wp_title(); ?></title>  //タイトル
<div id="header">
<h1><a href="<?php echo home_url('/');?>"><?php bloginfo('name');?></a></h1>
<p id="desc"><?php bloginfo('description');?></p>
<p id="image"><img src="<?php bloginfo('template_url');?>/screenshot.jpg" alt="*" width="300" height="225"></p>
</div>
ヘッダーまで使用したwordpressテンプレートタグ

              
bloginfo('html_type');コンテンツタイプを出力
bloginfo('charset');エンコードを出力
bloginfo('name'); ブログ名出力
bloginfo('description');ブログの説明を出力
echo home_url('/');トップページのURLを出力
bloginfo('stylesheet_url');スタイルシート(style.css)の出力
bloginfo('template_url');テーマフォルダのURLを出力

コンテンツ内の記事の繰り返しを作成

大枠としてdiv#content内に記事の繰り返し文を作り、
その内側にdiv.postとして個別記事を設置する。

<div id="content">
  <?php if(have_posts()): while(have_posts()): the_post(); ?>
  <div class="post"><!--コンテンツテキスト -->
  <h2><a href="<?php the_permalink();?>"><?php the_title();?></a></h2>
  <?php the_content();?>
  </div><!-- endコンテンツテキスト -->
  <?php endwhile; endif; ?>
</div><!-- endコンテンツ -->

各個別記事(div#content内)の末尾に”記事作成日時”と”記事のカテゴリ”を出力する

<p class="postinfo"><!--記事情報:記事作成日時とそのカテゴリー-->
  <?php echo get_the_date();?>|<?php the_time();?>
  |カテゴリ:<?php the_category(',');?>
</p>
コンテンツ内で使用したwordpressテンプレートタグ

if(have_posts()): while(have_posts()): the_post();
〜endwhile;endif;
複数の記事を格納してるDBから記事データを出力&ループする。
the_permalink(); 個別記事のURLを出力
the_title(); 個別記事タイトルを出力
the_content(); 個別記事の本文を出力
get_the_date(); 個別記事の作成日を出力
the_time();個別記事作成時を出力
the_category(',');個別記事のカテゴリを出力