Skip to content

Instantly share code, notes, and snippets.

@dylan-k
Last active October 20, 2021 18:22
Show Gist options
  • Save dylan-k/7968254 to your computer and use it in GitHub Desktop.
Save dylan-k/7968254 to your computer and use it in GitHub Desktop.
Wordpress Post Metadata Snippet
<?php
/*
Snippet Name: Dylan's Post-Metadata Snippet for Wordpress.
Description: Shows the date with lots of extra features. the year links to the year, the month to the month, the day to the day. with a plugin, you can also show details like "late in the evening" and "two years ago"
Dependencies:
http://wordpress.org/plugins/when/
http://wordpress.org/extend/plugins/wp-days-ago/
Usage:
I like to store this file in /theme/templates/parts/post-meta.php
then i can just do this to bring it up: <?php get_template_part( '/templates/parts/post', 'meta' ); ?>
*/
?>
<footer class="entry-footer">
<span class="published-date">
<i class="glyphicon glyphicon-calendar" title="Published date"></i>
This entry was posted <?php when::the_time(); ?>,
<?php if (function_exists('wp_days_ago_ajax')) { ?>
<? wp_days_ago_ajax(); ?>, on
<?php } ?>
<time class="published" datetime="<?php echo get_the_time('c'); ?>">
<?php the_time('l') ?>,
<a href="<?php bloginfo('url'); ?>/<?php the_time('Y') ?>/<?php the_time('m') ?>/">
<?php the_time('F') ?>
</a>
<a href="<?php bloginfo('url'); ?>/<?php the_time('Y') ?>/<?php the_time('m') ?>/<?php the_time('j') ?>/">
<?php the_time('jS') ?>
</a>,
<a href="<?php bloginfo('url'); ?>/<?php the_time('Y') ?>/">
<?php the_time('Y') ?>
</a>
</time>
</span>
by
<span class="byline author vcard"> <a href="<?php echo get_author_posts_url(get_the_author_meta('ID')); ?>" rel="author" class="fn"><?php echo get_the_author(); ?></a></span>
<?php the_tags('and is tagged ',', '); ?>, <?php the_category(', '); ?>,
</footer>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment