Move roots_entry_meta into its own template

No need for this HTML to be in a function. Now instead of calling the
function, just use get_template_part
This commit is contained in:
Scott Walkinshaw
2012-09-19 13:58:57 -04:00
parent 267e24e9a3
commit b61a3b0285
4 changed files with 5 additions and 10 deletions

View File

@@ -1,7 +0,0 @@
<?php
// Return post entry meta information
function roots_entry_meta() {
echo '<time class="updated" datetime="'. get_the_time('c') .'" pubdate>'. sprintf(__('Posted on %s at %s.', 'roots'), get_the_date(), get_the_time()) .'</time>';
echo '<p class="byline author vcard">'. __('Written by', 'roots') .' <a href="'. get_author_posts_url(get_the_author_meta('ID')) .'" rel="author" class="fn">'. get_the_author() .'</a></p>';
}

View File

@@ -2,7 +2,7 @@
<article <?php post_class() ?> id="post-<?php the_ID(); ?>">
<header>
<h1 class="entry-title"><?php the_title(); ?></h1>
<?php roots_entry_meta(); ?>
<?php get_template_part('templates/entry-meta'); ?>
</header>
<div class="entry-content">
<?php the_content(); ?>
@@ -13,4 +13,4 @@
</footer>
<?php comments_template('/templates/comments.php'); ?>
</article>
<?php endwhile; ?>
<?php endwhile; ?>

View File

@@ -10,7 +10,7 @@
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<header>
<h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
<?php roots_entry_meta(); ?>
<?php get_template_part('templates/entry-meta'); ?>
</header>
<div class="entry-content">
<?php the_excerpt(); ?>

2
templates/entry-meta.php Normal file
View File

@@ -0,0 +1,2 @@
<time class="updated" datetime="<?php echo get_the_time('c'); ?>" pubdate><?php echo sprintf(__('Posted on %s at %s.', 'roots'), get_the_date(), get_the_time()); ?></time>
<p class="byline author vcard"><?php echo __('Written by', 'roots'); ?> <a href="<?php echo get_author_posts_url(get_the_author_meta('ID')); ?>" rel="author" class="fn"><?php echo get_the_author(); ?></a></p>