初期設定
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>
コンテンツ内の記事の繰り返しを作成
大枠として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>