Skip to main content

Ivan Teoh

Something personal yet public

WordPress Theme Development 16 - Page Template

No matter how, we still felt we need to have a different template for site pages. Page template should not have both the meta post data and comment info. We took the main index template and modified it. The final code is as below as reference.

97-index.php (Source)

 * @package WordPress
 * @subpackage Your_Theme
get_header(); ?>
<div id="container">
<div id="content">
<?php if (have_posts()) : ?>
    <?php while (have_posts()) : ?>
        <?php the_post(); ?>
        <div <?php post_class(); ?> id="post-<?php the_ID(); ?>">
        <div class="entry-title">
        <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php
          printf( __('Permalink Link to %s'), the_title_attribute('echo=0') );
          ?>"><?php the_title(); ?></a></h2>
        </div><!-- .entry-title -->
        <div class="entry-content">
        <?php the_content(__('Read more...')); ?>
        <p><?php wp_link_pages(); ?></p>
        </div><!-- .entry-content -->
        <div class="entry-meta">
        <p><?php edit_post_link(__('Edit This')); ?></p>
        </div><!-- .entry-meta -->
    <?php endwhile; ?>
<?php else : ?>
<h2><?php _e('Not Found'); ?></h2>
<p><?php _e('Sorry, but you are looking for something that isn&#39;t here.');
<?php endif; ?>
</div><!-- #content -->
</div><!-- #container -->
<?php get_sidebar(); ?>
<?php get_footer(); ?>


Comments powered by Disqus