content.php 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <?php
  2. /**
  3. * The template for displaying content on archive and index pages
  4. *
  5. * @package Libretto
  6. */
  7. ?>
  8. <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
  9. <?php
  10. // Determine the post type, so we can adjust the display accordingly
  11. $post_format = get_post_format();
  12. // Only long-form posts will show header data
  13. if ( 'quote' !== $post_format && 'status' !== $post_format && 'link' !== $post_format && 'aside' !== $post_format ) :
  14. ?>
  15. <header class="entry-header">
  16. <div class="entry-meta">
  17. <?php libretto_posted_on(); ?>
  18. <?php if ( ! post_password_required() && ( comments_open() && '0' !== get_comments_number() ) ) : // Show comment count if > 0 ?>
  19. <span class="sep"> &#183; </span>
  20. <span class="comments-link"><?php comments_popup_link( __( 'Leave a comment', 'libretto' ), __( '1 Comment', 'libretto' ), __( '% Comments', 'libretto' ) ); ?></span>
  21. <?php endif; ?>
  22. <?php edit_post_link( __( 'Edit', 'libretto' ), '<span class="sep"> &#183; </span><span class="edit-link">', '</span>' ); ?>
  23. </div><!-- .entry-meta -->
  24. <?php if ( 'link' !== $post_format && 'aside' !== $post_format && 'status' !== $post_format ) : // Show title for most formats ?>
  25. <?php the_title( sprintf( '<h2 class="entry-title"><a href="%s" rel="bookmark">', esc_url( get_permalink() ) ), '</a></h2>' ); ?>
  26. <?php endif; ?>
  27. </header><!-- .entry-header -->
  28. <?php endif; // End header output ?>
  29. <?php
  30. // Show the featured image, for posts that have one and aren't already image, video, or gallery posts
  31. if ( libretto_has_post_thumbnail() && 'image' !== $post_format && 'gallery' !== $post_format && 'video' !== $post_format ) :
  32. $attachment_size = apply_filters( 'libretto_attachment_size', 'libretto-oversized' );
  33. // Finally, show the image
  34. ?>
  35. <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>">
  36. <?php the_post_thumbnail( $attachment_size, array( 'class' => 'featured-image' ) ); ?>
  37. </a>
  38. <?php endif; // End featured image output ?>
  39. <div class="entry-content">
  40. <?php the_content( __( 'Read more', 'libretto' ) ); ?>
  41. </div><!-- .entry-content -->
  42. <?php // Show post footers for abbreviated post types
  43. if ( 'quote' === $post_format || 'status' === $post_format || 'link' === $post_format || 'aside' === $post_format ) :
  44. ?>
  45. <footer class="entry-footer">
  46. <?php // Show title if one exists; otherwise, show the date
  47. if ( '' !== get_the_title() ) :
  48. the_title( sprintf( '<a href="%s" rel="bookmark">', esc_url( get_permalink() ) ), '</a>' );
  49. else :
  50. libretto_posted_on();
  51. endif;
  52. ?>
  53. <?php if ( ! post_password_required() && ( comments_open() && '0' !== get_comments_number() ) ) : ?>
  54. <span class="sep"> &#183; </span>
  55. <span class="comments-link"><?php comments_popup_link( __( 'Leave a comment', 'libretto' ), __( '1 Comment', 'libretto' ), __( '% Comments', 'libretto' ) ); ?></span>
  56. <?php endif; ?>
  57. <?php edit_post_link( __( 'Edit', 'libretto' ), '<span class="edit-link">', '</span>' ); ?>
  58. </footer><!-- .entry-meta -->
  59. <?php endif; ?>
  60. </article><!-- #post-## -->