- reduced using get_the_time( 'U', $post_id ); and current_time( 'timestamp' );

This commit is contained in:
Mykyta Synelnikov
2023-09-22 20:29:40 +03:00
parent 45a22f371e
commit 01ee8305a2
4 changed files with 28 additions and 24 deletions
+26 -21
View File
@@ -6,7 +6,7 @@
*
* Page: "Profile"
*
* @version 2.6.1
* @version 2.6.12
*
* @var object $post
*/
@@ -17,44 +17,49 @@ if ( ! defined( 'ABSPATH' ) ) {
<div class="um-item">
<div class="um-item-link">
<i class="um-icon-ios-paper"></i>
<a href="<?php echo esc_url( get_permalink( $post ) ); ?>"><?php echo get_the_title( $post ); ?></a>
<a href="<?php echo esc_url( get_permalink( $post ) ); ?>"><?php echo wp_kses( get_the_title( $post ), UM()->get_allowed_html( 'templates' ) ); ?></a>
</div>
<?php if ( has_post_thumbnail( $post->ID ) ) {
$image_id = get_post_thumbnail_id( $post->ID );
$image_url = wp_get_attachment_image_src( $image_id, 'full', true ); ?>
<?php
if ( has_post_thumbnail( $post->ID ) ) {
$image_id = get_post_thumbnail_id( $post->ID );
$image_url = wp_get_attachment_image_src( $image_id, 'full', true );
?>
<div class="um-item-img">
<a href="<?php echo esc_url( get_permalink( $post ) ); ?>">
<?php echo get_the_post_thumbnail( $post->ID, 'medium' ); ?>
</a>
</div>
<?php
}
<?php } ?>
$unix_published_date = get_post_datetime( $post, 'date', 'gmt' );
?>
<div class="um-item-meta">
<span>
<?php
// translators: %s: years.
printf( __( '%s ago', 'ultimate-member' ), human_time_diff( get_the_time( 'U', $post->ID ), current_time( 'timestamp' ) ) );
// translators: %s: human time diff.
echo esc_html( sprintf( __( '%s ago', 'ultimate-member' ), human_time_diff( $unix_published_date->getTimestamp() ) ) );
?>
</span>
<span>
<?php _e( 'in', 'ultimate-member' ); ?>: <?php the_category( ', ', '', $post->ID ); ?>
<?php
// translators: %s: categories list.
echo wp_kses( sprintf( __( 'in: %s', 'ultimate-member' ), get_the_category_list( ', ', '', $post->ID ) ), UM()->get_allowed_html( 'templates' ) );
?>
</span>
<span>
<?php $num_comments = get_comments_number( $post->ID );
if ( $num_comments == 0 ) {
$comments = __( 'no comments', 'ultimate-member' );
} elseif ( $num_comments > 1 ) {
// translators: %s: coments number.
$comments = sprintf( __( '%s comments', 'ultimate-member' ), $num_comments );
<?php
$num_comments = absint( get_comments_number( $post ) );
if ( 0 === $num_comments ) {
$comments_html = __( 'no comments', 'ultimate-member' );
} else {
$comments = __( '1 comment', 'ultimate-member' );
} ?>
<a href="<?php echo esc_url( get_comments_link( $post->ID ) ); ?>"><?php echo $comments; ?></a>
// translators: %s: comments number.
$comments_html = sprintf( _n( '%s comment', '%s comments', $num_comments, 'ultimate-member' ), $num_comments );
}
?>
<a href="<?php echo esc_url( get_comments_link( $post->ID ) ); ?>"><?php echo esc_html( $comments_html ); ?></a>
</span>
</div>
</div>