Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Show Time in Post Date Meta */
- function jeg_get_post_date( $format = '', $post = null ) {
- $publish_date = isset( $post->publish_date ) ? date( $format ?: 'Y-m-d', $post->publish_date ) : get_the_date( $format, $post );
- $modified_date = isset( $post->update_date ) ? date( $format ?: 'Y-m-d', $post->update_date ) : get_the_modified_date( $format, $post );
- $publish_date_number_format = isset( $post->publish_date ) ? date( 'Y-m-d', $post->publish_date ) : get_the_date( 'Y-m-d', $post );
- $modified_date_number_format = isset( $post->update_date ) ? date( 'Y-m-d', $post->update_date ) : get_the_modified_date( 'Y-m-d', $post );
- $publish_date .= ' - ' . get_post_time( 'h:i A', null, $post );
- $modified_date .= ' - ' . get_post_time( 'h:i A', null, $post );
- if ( get_theme_mod( 'jnews_global_post_date', 'modified' ) === 'publish' ) {
- return $publish_date;
- } elseif ( get_theme_mod( 'jnews_global_post_date', 'modified' ) === 'both' ) {
- if ( strtotime( $publish_date_number_format ) >= strtotime( $modified_date_number_format ) ) {
- return $publish_date;
- } else {
- return $publish_date . ' - ' . jnews_return_translation( 'Updated on', 'jnews', 'updated_on' ) . ' ' . $modified_date;
- }
- } elseif ( get_theme_mod( 'jnews_global_post_date', 'modified' ) === 'modified' ) {
- if ( strtotime( $publish_date_number_format ) >= strtotime( $modified_date_number_format ) ) {
- return $publish_date;
- } else {
- return $modified_date;
- }
- }
- return $publish_date;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement