Skip to content

Instantly share code, notes, and snippets.

@Aziz-Rahman
Created February 16, 2015 02:39
Show Gist options
  • Save Aziz-Rahman/56ec268fa759d2abe290 to your computer and use it in GitHub Desktop.
Save Aziz-Rahman/56ec268fa759d2abe290 to your computer and use it in GitHub Desktop.
To Display meta
<?php
/**
* Function to display post meta
*
* @package WordPress
* @subpackage My Theme
* @since My Theme 1.0.0
*/
if ( ! function_exists( 'my_post_meta' ) ) {
function my_post_meta() {
global $post;
$author = '<a href="' . get_author_posts_url($post->post_author) . '">' . get_the_author() . '</a>';
$time = sprintf( __('%s ago', 'mytheme1'), human_time_diff( get_the_time('U'), current_time('timestamp') ) ) ;
?>
<div class="meta">
<span><i class="fa fa-child"></i> <?php _e('Posted by', 'mytheme1'); ?> <?php echo $author; ?></span>
<span><i class="fa fa-calendar"></i> <?php echo date_i18n('M jS, Y'); ?></span>
<span><i class="fa fa-clock-o"></i> <?php echo $time; ?></span>
</div>
<?php
}
}
?>
<!-- Untuk pemanggilan -->
<?php my_post_meta(); ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment