Advertisement
arie_cristianD

override function jeg_get_post_date

Jan 17th, 2024 (edited)
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.38 KB | None | 0 0
  1. function jeg_get_post_date( $format = '', $post = null ) {
  2.     $publish_date                = isset( $post->publish_date ) ? date( $format ?: 'Y-m-d', $post->publish_date ) : get_the_date( $format, $post );
  3.     $modified_date               = isset( $post->update_date ) ? date( $format ?: 'Y-m-d', $post->update_date ) : get_the_modified_date( $format, $post );
  4.     $publish_date_number_format  = isset( $post->publish_date ) ? date( 'Y-m-d', $post->publish_date ) : get_the_date( 'Y-m-d', $post );
  5.     $modified_date_number_format = isset( $post->update_date ) ? date( 'Y-m-d', $post->update_date ) : get_the_modified_date( 'Y-m-d', $post );
  6.     if ( get_theme_mod( 'jnews_global_post_date', 'modified' ) === 'publish' ) {
  7.         return $publish_date;
  8.     } elseif ( get_theme_mod( 'jnews_global_post_date', 'modified' ) === 'both' ) {
  9.         if ( strtotime( $publish_date_number_format ) >= strtotime( $modified_date_number_format ) ) {
  10.             return 'Yayın tarihi ' . $publish_date;
  11.         } else {
  12.             return 'Yayın tarihi ' . $publish_date . ' ve Güncelleme ' . jnews_return_translation( 'Tarihi', 'jnews', 'updated_on' ) . ' ' . $modified_date;
  13.         }
  14.     } elseif ( get_theme_mod( 'jnews_global_post_date', 'modified' ) === 'modified' ) {
  15.         if ( strtotime( $publish_date_number_format ) >= strtotime( $modified_date_number_format ) ) {
  16.             return $publish_date;
  17.         } else {
  18.             return $modified_date;
  19.         }
  20.     }
  21.  
  22.     return $publish_date;
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement