twentyfifteen_entry_meta

Prints HTML with meta information for the categories, tags.

Description

twentyfifteen_entry_meta(); 

Usage

  1. if ( !function_exists( 'twentyfifteen_entry_meta' ) ) { 
  2. require_once '/inc/template-tags.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = twentyfifteen_entry_meta(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/inc/template-tags.php  
  1. function twentyfifteen_entry_meta() { 
  2. if ( is_sticky() && is_home() && ! is_paged() ) { 
  3. printf( '<span class="sticky-post">%s</span>', __( 'Featured', 'twentyfifteen' ) ); 
  4.  
  5. $format = get_post_format(); 
  6. if ( current_theme_supports( 'post-formats', $format ) ) { 
  7. printf( '<span class="entry-format">%1$s<a href="%2$s">%3$s</a></span>',  
  8. sprintf( '<span class="screen-reader-text">%s </span>', _x( 'Format', 'Used before post format.', 'twentyfifteen' ) ),  
  9. esc_url( get_post_format_link( $format ) ),  
  10. get_post_format_string( $format ) 
  11. ); 
  12.  
  13. if ( in_array( get_post_type(), array( 'post', 'attachment' ) ) ) { 
  14. $time_string = '<time class="entry-date published updated" datetime="%1$s">%2$s</time>'; 
  15.  
  16. if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) { 
  17. $time_string = '<time class="entry-date published" datetime="%1$s">%2$s</time><time class="updated" datetime="%3$s">%4$s</time>'; 
  18.  
  19. $time_string = sprintf( $time_string,  
  20. esc_attr( get_the_date( 'c' ) ),  
  21. get_the_date(),  
  22. esc_attr( get_the_modified_date( 'c' ) ),  
  23. get_the_modified_date() 
  24. ); 
  25.  
  26. printf( '<span class="posted-on"><span class="screen-reader-text">%1$s </span><a href="%2$s" rel="bookmark">%3$s</a></span>',  
  27. _x( 'Posted on', 'Used before publish date.', 'twentyfifteen' ),  
  28. esc_url( get_permalink() ),  
  29. $time_string 
  30. ); 
  31.  
  32. if ( 'post' == get_post_type() ) { 
  33. if ( is_singular() || is_multi_author() ) { 
  34. printf( '<span class="byline"><span class="author vcard"><span class="screen-reader-text">%1$s </span><a class="url fn n" href="%2$s">%3$s</a></span></span>',  
  35. _x( 'Author', 'Used before post author name.', 'twentyfifteen' ),  
  36. esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),  
  37. get_the_author() 
  38. ); 
  39.  
  40. $categories_list = get_the_category_list( _x( ', ', 'Used between list items, there is a space after the comma.', 'twentyfifteen' ) ); 
  41. if ( $categories_list && twentyfifteen_categorized_blog() ) { 
  42. printf( '<span class="cat-links"><span class="screen-reader-text">%1$s </span>%2$s</span>',  
  43. _x( 'Categories', 'Used before category names.', 'twentyfifteen' ),  
  44. $categories_list 
  45. ); 
  46.  
  47. $tags_list = get_the_tag_list( '', _x( ', ', 'Used between list items, there is a space after the comma.', 'twentyfifteen' ) ); 
  48. if ( $tags_list ) { 
  49. printf( '<span class="tags-links"><span class="screen-reader-text">%1$s </span>%2$s</span>',  
  50. _x( 'Tags', 'Used before tag names.', 'twentyfifteen' ),  
  51. $tags_list 
  52. ); 
  53.  
  54. if ( is_attachment() && wp_attachment_is_image() ) { 
  55. // Retrieve attachment metadata. 
  56. $metadata = wp_get_attachment_metadata(); 
  57.  
  58. printf( '<span class="full-size-link"><span class="screen-reader-text">%1$s </span><a href="%2$s">%3$s × %4$s</a></span>',  
  59. _x( 'Full size', 'Used before full size attachment link.', 'twentyfifteen' ),  
  60. esc_url( wp_get_attachment_url() ),  
  61. $metadata['width'],  
  62. $metadata['height'] 
  63. ); 
  64.  
  65. if ( ! is_single() && ! post_password_required() && ( comments_open() || get_comments_number() ) ) { 
  66. echo '<span class="comments-link">'; 
  67. /** translators: %s: post title */ 
  68. comments_popup_link( sprintf( __( 'Leave a comment<span class="screen-reader-text"> on %s</span>', 'twentyfifteen' ), get_the_title() ) ); 
  69. echo '</span>';