Нет описания

posts-single.php 1.4KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php if ( ! defined( 'ABSPATH' ) ) exit; ?>
  2. <div class="um-item">
  3. <div class="um-item-link">
  4. <i class="um-icon-ios-paper"></i>
  5. <a href="<?php echo esc_url( get_permalink( $post ) ); ?>"><?php echo get_the_title( $post ); ?></a>
  6. </div>
  7. <?php if ( has_post_thumbnail( $post->ID ) ) {
  8. $image_id = get_post_thumbnail_id( $post->ID );
  9. $image_url = wp_get_attachment_image_src( $image_id, 'full', true ); ?>
  10. <div class="um-item-img">
  11. <a href="<?php echo esc_url( get_permalink( $post ) ); ?>">
  12. <?php echo get_the_post_thumbnail( $post->ID, 'medium' ); ?>
  13. </a>
  14. </div>
  15. <?php } ?>
  16. <div class="um-item-meta">
  17. <span>
  18. <?php printf( __( '%s ago', 'ultimate-member' ), human_time_diff( get_the_time( 'U', $post->ID ), current_time( 'timestamp' ) ) ); ?>
  19. </span>
  20. <span>
  21. <?php _e( 'in', 'ultimate-member' ); ?>: <?php the_category( ', ', '', $post->ID ); ?>
  22. </span>
  23. <span>
  24. <?php $num_comments = get_comments_number( $post->ID );
  25. if ( $num_comments == 0 ) {
  26. $comments = __( 'no comments', 'ultimate-member' );
  27. } elseif ( $num_comments > 1 ) {
  28. $comments = sprintf( __( '%s comments', 'ultimate-member' ), $num_comments );
  29. } else {
  30. $comments = __( '1 comment', 'ultimate-member' );
  31. } ?>
  32. <a href="<?php echo esc_url( get_comments_link( $post->ID ) ); ?>"><?php echo $comments; ?></a>
  33. </span>
  34. </div>
  35. </div>