Skip to content

Instantly share code, notes, and snippets.

@themeblvd
Created August 6, 2014 21:20
Show Gist options
  • Save themeblvd/c527875a4289dd9b881e to your computer and use it in GitHub Desktop.
Save themeblvd/c527875a4289dd9b881e to your computer and use it in GitHub Desktop.
If an older theme wasn't already using a custom action for meta, this will default back to the way it was before framework 2.5
<?php
/**
* If an older theme wasn't already using a custom
* action for meta, this will default back to the
* way it was before framework 2.5
*/
function theme_meta( $input ) {
// Separator
$sep = apply_filters( 'themeblvd_meta_separator', '<span class="sep"> / </span>' );
// Start output
$output = '<div class="entry-meta">';
// Time
$time = sprintf('<time class="entry-date updated" datetime="%s"><i class="fa fa-calendar"></i> %s</time>', get_the_time('c'), get_the_time( get_option( 'date_format' ) ) );
$output .= $time;
// Author
$author_url = get_author_posts_url( get_the_author_meta('ID') );
$author_title = sprintf( __( 'View all posts by %s', 'themeblvd_frontend' ), get_the_author() );
$author = sprintf( '<span class="author vcard"><i class="fa fa-user"></i> <a class="url fn n" href="%s" title="%s" rel="author">%s</a></span>', $author_url, $author_title, get_the_author() );
$output .= $sep;
$output .= $author;
// Category
$category = '';
if ( has_category() ) {
$category = sprintf( '<span class="category"><i class="fa fa-bars"></i> %s</span>', get_the_category_list(', ') );
$output .= $sep;
$output .= $category;
}
// Comments
$comments = '';
if( comments_open() ) {
$output .= $sep;
$comments .= '<span class="comments-link">';
ob_start();
comments_popup_link( '<span class="leave-reply">'.themeblvd_get_local( 'no_comments' ).'</span>', '1 '.themeblvd_get_local( 'comment' ), '% '.themeblvd_get_local( 'comments' ) );
$comment_link = ob_get_clean();
$comments .= sprintf( '<i class="fa fa-comment"></i> %s', $comment_link, $sep );
$comments .= '</span>';
$output .= $comments;
}
$output .= '</div><!-- .entry-meta -->';
return $output;
}
add_filter( 'themeblvd_meta', 'theme_meta' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment