Guest User

Untitled

a guest
Nov 18th, 2017
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. function presscore_get_post_fancy_date( $new_class = '' ) {
  2.  
  3. if ( !in_the_loop() ) {
  4. return '';
  5. }
  6.  
  7. $class = 'fancy-date' . ( $new_class ? ' ' . trim($new_class) : '' );
  8. $href = 'javascript:void(0);';
  9.  
  10. if ( 'post' == get_post_type() ) {
  11.  
  12. // remove link if in date archive
  13. if ( !(is_day() && is_month() && is_year()) ) {
  14.  
  15. $href = presscore_get_post_day_link();
  16. }
  17. }
  18.  
  19. return sprintf(
  20. '<div class="%s"><a title="%s" href="%s" rel="nofollow"><span class="entry-month">%s</span><span class="entry-date updated">%s</span><span class="entry-year">%s</span></a></div>',
  21. esc_attr( $class ), // class
  22. esc_attr( get_the_time() ), // title
  23. $href, // href
  24. esc_html( get_the_date( 'Y' ) ), // year
  25. esc_html( get_the_date( 'j' ) ), // date
  26. esc_attr( get_the_date( 'M' ) ) // month
  27. );
  28.  
  29. }
Add Comment
Please, Sign In to add comment