Skip to content

Instantly share code, notes, and snippets.

@tenman
Created February 13, 2014 09:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tenman/8972387 to your computer and use it in GitHub Desktop.
Save tenman/8972387 to your computer and use it in GitHub Desktop.
comment link at posted_in for Raindrops theme
<?php
add_filter( 'raindrops_posted_in', 'my_add_comments' );
function my_add_comments( $posted_in ) {
return $posted_in. raindrops_comments_link();
}
function raindrops_comments_link() {
if ( comments_open( ) ) {
$raindrops_comment_html = '<a href="%1$s" class="raindrops-comment-link"><span class="raindrops-comment-string point"></span><em>%2$s %3$s</em></a>';
if ( get_comments_number( ) > 0 ) {
$raindrops_comment_string = _n( 'Comment', 'Comments', get_comments_number( ), 'Raindrops' ) . raindrops_link_unique( 'Post', get_the_ID( ) );
$raindrops_comment_number = get_comments_number( );
} else {
$raindrops_comment_string = __( 'Comment ', 'Raindrops' ) . raindrops_link_unique( 'Post', get_the_ID( ) );
$raindrops_comment_number = '';
}
} else {
$raindrops_comment_html = '';
$raindrops_comment_string = '';
$raindrops_comment_number = '';
}
$result = sprintf( $raindrops_comment_html, get_comments_link( ), $raindrops_comment_number, $raindrops_comment_string );
return apply_filters( 'raindrops_comments_link', $result, get_comments_link( ), $raindrops_comment_number, $raindrops_comment_string );
}
function raindrops_posted_on( ) {
global $post;
$raindrops_date_format = get_option( 'date_format' ) . ' ' . get_option( 'time_format' );
$author = raindrops_blank_fallback( get_the_author( ), 'Somebody' );
$archive_year = get_the_time( 'Y' );
$archive_month = get_the_time( 'm' );
$archive_day = get_the_time( 'd' );
$day_link = esc_url( get_day_link( $archive_year, $archive_month, $archive_day ) . '#post-' . $post->ID );
$result = sprintf( esc_html__( '%1$s %5$s %2$s %6$s %3$s %4$s', 'Raindrops' ),
'<span class="meta-prep meta-prep-author">',
'</span>' . sprintf( '<a href="%1$s" title="%2$s"><%4$s class="entry-date updated" %5$s>%3$s</%4$s></a>',
$day_link, esc_attr( 'archives daily ' . get_the_time( $raindrops_date_format ) ),
get_the_date( $raindrops_date_format ),
raindrops_doctype_elements( 'span', 'time', false ),
raindrops_doctype_elements( '', 'datetime="' . esc_attr( get_the_date( 'c' ) ) . '"', false ) ) . '<span class="meta-sep">', '</span>' . sprintf( '<span class="author vcard"><a class="url fn n" href="%1$s" title="%2$s" rel="vcard:url">%3$s</a></span> ', get_author_posts_url( get_the_author_meta( 'ID' ) ),
sprintf( esc_attr__( 'View all posts by %s', 'Raindrops' ), $author ), $author ),
'',
'<span class="posted-on-string">' . __( 'Posted on', 'Raindrops' ) . '</span>',
'<span class="posted-by-string">' . __( 'by', 'Raindrops' ) . '</span>' );
$format = get_post_format( );
$content_empty_check = trim( get_the_content( ) );
if ( false === $format ) {
echo apply_filters( "raindrops_posted_on", $result );
} elseif ( empty( $content_empty_check ) ) {
echo raindrops_comments_link();
} else {
echo apply_filters( "raindrops_posted_on", $result );
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment