Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!

Date Format Function Serene WordPress Theme

By: Anderton on Nov 3rd, 2013  |  syntax: PHP  |  size: 1.57 KB  |  views: 55  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. /* The default Date Format function in Serene WordPress Theme */
  2.  
  3. if ( ! function_exists( 'serene_post_meta_info' ) ) :
  4. function serene_post_meta_info() { ?>
  5.         <div class="meta-date">
  6.                 <div class="meta-date-wrap">
  7.                 <?php
  8.                         printf( '<span class="meta-post-date"><strong>%s.</strong>%s</span> <a href="%s"><div class="meta-comments-count"><span aria-hidden="true" class="icon_comment_alt"></span>%s</div></a>',
  9.                                 get_the_time( _x( 'M', 'post info month name', 'Serene' ) ),
  10.                                 get_the_time( _x( 'd', 'post info day', 'Serene' ) ),
  11.                                 esc_url( get_permalink() ),
  12.                                 sprintf( _n( '1', '%1$s', get_comments_number(), 'Serene'), number_format_i18n( get_comments_number() ) )
  13.                         );
  14.                 ?>
  15.                 </div>
  16.         </div>
  17. <?php }
  18. endif;
  19.  
  20.  
  21. /* Modified Date Format function in Serene WordPress Theme. Show Year, Month and Day */
  22. /* Example: 2013-11-04  (In PHP: Y-m-d) */
  23. /* See PHP Time for usage: http://codex.wordpress.org/Formatting_Date_and_Time */
  24. /* Replace the above code with the code below. */
  25.  
  26. if ( ! function_exists( 'serene_post_meta_info' ) ) :
  27. function serene_post_meta_info() { ?>
  28.         <div class="meta-date">
  29.                 <div class="meta-date-wrap">
  30.                 <?php
  31.                         printf( '<span class="meta-post-date">%s</span> <a href="%s"><div class="meta-comments-count"><span aria-hidden="true" class="icon_comment_alt"></span>%s</div></a>',
  32.                                 get_the_time( _x( 'Y-m-d', 'post info date name', 'Serene' ) ),
  33.                                                             esc_url( get_permalink() ),
  34.                                                                 sprintf( _n( '1', '%1$s', get_comments_number(), 'Serene'), number_format_i18n( get_comments_number() ) )
  35.                         );
  36.                 ?>
  37.                 </div>
  38.         </div>
  39. <?php }
  40. endif;