オリジナルテンプレートの作り方

テンプレートの冒頭部分に、下記の書式でテンプレート名を記載してください。

<?php
/*
Template Name: Hoge
*/
?>

テンプレート名は、テーマエディタの中に表示されますので、あとから選択することも考えて区別しやすい名前にしましょう

例:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<?php
/*
Template Name: Archives with Content
*/
?>
 
<?php get_header(); ?>
 
<div id="content" class="widecolumn">
 
 <?php if (have_posts()) : while (have_posts()) : the_post();?>
 <div class="post">
  <h2 id="post-<?php the_ID(); ?>"><?php the_title();?></h2>
  <div class="entrytext">
   <?php the_content('<p class="serif">Read the rest of this page &raquo;</p>'); ?>
  </div>
 </div>
 <?php endwhile; endif; ?>
 <?php edit_post_link('Edit this entry.', '<p>', '</p>'); ?>
 
</div>
<div id="main">
 
<?php include (TEMPLATEPATH . '/searchform.php'); ?>
 
<h2>Archives by Month:</h2>
  <ul>
    <?php wp_get_archives('type=monthly'); ?>
  </ul>
 
<h2>Archives by Subject:</h2>
  <ul>
     <?php wp_list_cats(); ?>
  </ul>
 
</div>
<?php get_footer(); ?>

Leave a Comment


NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" highlight="">