|
IT News > トピックス > WordPress > オリジナルテンプレートの作り方 Page TemplatesIndividual Pages can be set to use a specific, custom Page Template that you create within your Theme (see Creating your own Page Templates below for how to create a custom template). To create a new Template for a Page you must create a file. テンプレートの冒頭部分に、下記の書式でテンプレート名を記載しておくことが必要です。 <?php /* Template Name: Snarfer */ ?> The above code defines this snarfer.php file as the "Snarfer" Template. This Template Name will appear in the Theme Editor as the link to edit this file. 参考URLCreating your own Page Templates(英語) 参考テンプレート<?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 »</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(); ?>
|