Advertisement
pratikshrestha

Allow Author

Sep 13th, 2016
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.66 KB | None | 0 0
  1. /**
  2.  * Prints HTML with meta information for the current post-date/time and author.
  3.  */
  4. function clean_magazine_entry_meta() {
  5.     echo '<p class="entry-meta">';
  6.  
  7.     $time_string = '<time class="entry-date published updated" datetime="%1$s">%2$s</time>';
  8.  
  9.     if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) {
  10.         $time_string = '<time class="entry-date published" datetime="%1$s">%2$s</time><time class="updated" datetime="%3$s">%4$s</time>';
  11.     }
  12.  
  13.     $time_string = sprintf( $time_string,
  14.         esc_attr( get_the_date( 'c' ) ),
  15.         esc_html( get_the_date() ),
  16.         esc_attr( get_the_modified_date( 'c' ) ),
  17.         esc_html( get_the_modified_date() )
  18.     );
  19.  
  20.     printf( '<span class="posted-on">%1$s<a href="%2$s" rel="bookmark">%3$s</a></span>',
  21.         sprintf( __( '<span class="screen-reader-text">Posted on</span>', 'clean-magazine' ) ),
  22.         esc_url( get_permalink() ),
  23.         $time_string
  24.     );
  25.  
  26.     printf( '<span class="byline"><span class="author vcard">%1$s<a class="url fn n" href="%2$s">%3$s</a></span></span>',
  27.         sprintf( _x( '<span class="screen-reader-text">Author</span>', 'Used before post author name.', 'clean-magazine' ) ),
  28.         esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
  29.         esc_html( get_the_author() )
  30.     );
  31.  
  32.     if ( ! post_password_required() && ( comments_open() || '0' != get_comments_number() ) ) {
  33.         echo '<span class="comments-link">';
  34.         comments_popup_link( esc_html__( 'Leave a comment', 'clean-magazine' ), esc_html__( '1 Comment', 'clean-magazine' ), esc_html__( '% Comments', 'clean-magazine' ) );
  35.         echo '</span>';
  36.     }
  37.  
  38.     edit_post_link( esc_html__( 'Edit', 'clean-magazine' ), '<span class="edit-link">', '</span>' );
  39.  
  40.     echo '</p><!-- .entry-meta -->';
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement