twentythirteen_entry_date

Print HTML with date information for current post.

Description

(string) twentythirteen_entry_date( (bool) $echo = true ); 

Create your own twentythirteen_entry_date() to override in a child theme.

Returns (string)

The HTML-formatted post date.

Parameters (1)

0. $echo — Optional. (bool) => true
Whether to echo the date. Default true.

Usage

  1. if ( !function_exists( 'twentythirteen_entry_date' ) ) { 
  2. require_once '/functions.php'; 
  3.  
  4. // (optional) Whether to echo the date. Default true. 
  5. $echo = true; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = twentythirteen_entry_date($echo); 
  9.  

Defined (1)

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

/functions.php  
  1. function twentythirteen_entry_date( $echo = true ) { 
  2. if ( has_post_format( array( 'chat', 'status' ) ) ) 
  3. $format_prefix = _x( '%1$s on %2$s', '1: post format name. 2: date', 'twentythirteen' ); 
  4. else 
  5. $format_prefix = '%2$s'; 
  6.  
  7. $date = sprintf( '<span class="date"><a href="%1$s" title="%2$s" rel="bookmark"><time class="entry-date" datetime="%3$s">%4$s</time></a></span>',  
  8. esc_url( get_permalink() ),  
  9. esc_attr( sprintf( __( 'Permalink to %s', 'twentythirteen' ), the_title_attribute( 'echo=0' ) ) ),  
  10. esc_attr( get_the_date( 'c' ) ),  
  11. esc_html( sprintf( $format_prefix, get_post_format_string( get_post_format() ), get_the_date() ) ) 
  12. ); 
  13.  
  14. if ( $echo ) 
  15. echo $date; 
  16.  
  17. return $date;