/loop.php

https://github.com/tonyahowe/ABO · PHP · 149 lines · 136 code · 13 blank · 0 comment · 32 complexity · 0b4ee1a2eea37517e285b5a8996eb4e1 MD5 · raw file

  1. <?php if ( $wp_query->max_num_pages > 1 ) : ?>
  2. <nav id="nav-above" class="navigation">
  3. <div class="nav-previous"><?php next_posts_link( __( '<span class="meta-nav">&larr;</span> Older posts', 'brunelleschi' ) ); ?></div>
  4. <div class="nav-next"><?php previous_posts_link( __( 'Newer posts <span class="meta-nav">&rarr;</span>', 'brunelleschi' ) ); ?></div>
  5. </nav><!-- #nav-above -->
  6. <?php endif; ?>
  7. <?php if ( ! have_posts() ) : ?>
  8. <div id="post-0" class="post error404 not-found">
  9. <h1 class="entry-title"><?php _e( 'Not Found', 'brunelleschi' ); ?></h1>
  10. <div class="entry-content">
  11. <p><?php _e( 'Apologies, but no results were found for the requested archive. Perhaps searching will help find a related post.', 'brunelleschi' ); ?></p>
  12. <?php get_search_form(); ?>
  13. </div><!-- .entry-content -->
  14. </div><!-- #post-0 -->
  15. <?php endif; ?>
  16. <?php while ( have_posts() ) : the_post(); ?>
  17. <?php if ( ( function_exists( 'get_post_format' ) && 'gallery' == get_post_format( $post->ID ) ) || in_category( _x( 'gallery', 'gallery category slug', 'brunelleschi' ) ) ) : ?>
  18. <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
  19. <header>
  20. <h2 class="entry-title"><a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'brunelleschi' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></a></h2>
  21. <?php if(brunelleschi_option('posted-on') === 'Above Post'): ?>
  22. <div class="entry-meta">
  23. <?php brunelleschi_posted_on(); ?>
  24. </div><!-- .entry-meta -->
  25. <?php endif; ?>
  26. </header>
  27. <div class="entry-content">
  28. <!-- end -->
  29. <?php if ( post_password_required() ) : ?>
  30. <?php the_content(); ?>
  31. <?php else : ?>
  32. <?php
  33. $images = get_children( array( 'post_parent' => $post->ID, 'post_type' => 'attachment', 'post_mime_type' => 'image', 'orderby' => 'menu_order', 'order' => 'ASC', 'numberposts' => 999 ) ); if ( $images ) :
  34. $total_images = count( $images );
  35. $image = array_shift( $images );
  36. $image_img_tag = wp_get_attachment_image( $image->ID, 'thumbnail' );
  37. ?>
  38. <div class="gallery-thumb">
  39. <a class="size-thumbnail" href="<?php the_permalink(); ?>"><?php echo $image_img_tag; ?></a>
  40. </div><!-- .gallery-thumb -->
  41. <p><em><?php printf( _n( 'This gallery contains <a %1$s>%2$s photo</a>.', 'This gallery contains <a %1$s>%2$s photos</a>.', $total_images, 'brunelleschi' ),
  42. 'href="' . get_permalink() . '" title="' . sprintf( esc_attr__( 'Permalink to %s', 'brunelleschi' ), the_title_attribute( 'echo=0' ) ) . '" rel="bookmark"',
  43. number_format_i18n( $total_images )
  44. ); ?></em></p>
  45. <?php endif; ?>
  46. <?php the_excerpt(); ?>
  47. <?php endif; ?>
  48. </div><!-- .entry-content -->
  49. <div class="entry-utility">
  50. <?php if(brunelleschi_option('posted-on') === 'Below Post'): ?>
  51. <div class="entry-meta">
  52. <?php brunelleschi_posted_on(); ?>
  53. </div><!-- .entry-meta -->
  54. <?php endif; ?>
  55. <?php if ( function_exists( 'get_post_format' ) && 'gallery' == get_post_format( $post->ID ) ) : ?>
  56. <a href="<?php echo get_post_format_link( 'gallery' ); ?>" title="<?php esc_attr_e( 'View Galleries', 'brunelleschi' ); ?>"><?php _e( 'More Galleries', 'brunelleschi' ); ?></a>
  57. <span class="meta-sep">|</span>
  58. <?php elseif ( in_category( _x( 'gallery', 'gallery category slug', 'brunelleschi' ) ) ) : ?>
  59. <a href="<?php echo get_term_link( _x( 'gallery', 'gallery category slug', 'brunelleschi' ), 'category' ); ?>" title="<?php esc_attr_e( 'View posts in the Gallery category', 'brunelleschi' ); ?>"><?php _e( 'More Galleries', 'brunelleschi' ); ?></a>
  60. <span class="meta-sep">|</span>
  61. <?php endif; ?>
  62. <span class="comments-link"><?php comments_popup_link( __( 'Leave a comment', 'brunelleschi' ), __( '1 Comment', 'brunelleschi' ), __( '% Comments', 'brunelleschi' ) ); ?></span>
  63. <?php edit_post_link( __( 'Edit', 'brunelleschi' ), '<span class="meta-sep">|</span> <span class="edit-link">', '</span>' ); ?>
  64. </div><!-- .entry-utility -->
  65. </article><!-- #post-## -->
  66. <?php elseif ( ( function_exists( 'get_post_format' ) && 'aside' == get_post_format( $post->ID ) ) || in_category( _x( 'asides', 'asides category slug', 'brunelleschi' ) ) ) : ?>
  67. <aside id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
  68. <?php if ( is_archive() || is_search() ) : // Display excerpts for archives and search. ?>
  69. <div class="entry-summary">
  70. <?php if( brunelleschi_option('archives-format') === '1' ){ the_content(); }else{ the_excerpt(); } ?>
  71. </div><!-- .entry-summary -->
  72. <?php else : ?>
  73. <div class="entry-content">
  74. <?php the_content( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'brunelleschi' ) ); ?>
  75. </div><!-- .entry-content -->
  76. <?php endif; ?>
  77. <div class="entry-utility">
  78. <?php brunelleschi_posted_on(); ?>
  79. <span class="meta-sep">|</span>
  80. <span class="comments-link"><?php comments_popup_link( __( 'Leave a comment', 'brunelleschi' ), __( '1 Comment', 'brunelleschi' ), __( '% Comments', 'brunelleschi' ) ); ?></span>
  81. <?php edit_post_link( __( 'Edit', 'brunelleschi' ), '<span class="meta-sep">|</span> <span class="edit-link">', '</span>' ); ?>
  82. </div><!-- .entry-utility -->
  83. </aside><!-- #post-## -->
  84. <?php else : ?>
  85. <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
  86. <header>
  87. <h2 class="entry-title"><a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'brunelleschi' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></a></h2>
  88. <?php if(brunelleschi_option('posted-on') === 'Above Post'): ?>
  89. <div class="entry-meta">
  90. <?php brunelleschi_posted_on(); ?>
  91. </div><!-- .entry-meta -->
  92. <?php endif; ?>
  93. </header>
  94. <?php if ( is_archive() || is_search() ) : ?>
  95. <div class="entry-summary">
  96. <?php if( brunelleschi_option('archives-format') === '1' ){ the_content(); }else{ the_excerpt(); } ?>
  97. </div><!-- .entry-summary -->
  98. <?php else : ?>
  99. <div class="entry-content">
  100. <?php the_content( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'brunelleschi' ) ); ?>
  101. <?php wp_link_pages( array( 'before' => '<div class="page-link">' . __( 'Pages:', 'brunelleschi' ), 'after' => '</div>' ) ); ?>
  102. </div><!-- .entry-content -->
  103. <?php endif; ?>
  104. <div class="entry-utility">
  105. <?php if(brunelleschi_option('posted-on') === 'Below Post'): ?>
  106. <div class="entry-meta">
  107. <?php brunelleschi_posted_on(); ?>
  108. </div><!-- .entry-meta -->
  109. <?php endif; ?>
  110. <?php if ( count( get_the_category() ) ) : ?>
  111. <span class="cat-links">
  112. <?php printf( __( '<span class="%1$s">Posted in</span> %2$s', 'brunelleschi' ), 'entry-utility-prep entry-utility-prep-cat-links', get_the_category_list( ', ' ) ); ?>
  113. </span>
  114. <span class="meta-sep">|</span>
  115. <?php endif; ?>
  116. <?php
  117. $tags_list = get_the_tag_list( '', ', ' );
  118. if ( $tags_list ):
  119. ?>
  120. <span class="tag-links">
  121. <?php printf( __( '<span class="%1$s">Tagged</span> %2$s', 'brunelleschi' ), 'entry-utility-prep entry-utility-prep-tag-links', $tags_list ); ?>
  122. </span>
  123. <span class="meta-sep">|</span>
  124. <?php endif; ?>
  125. <span class="comments-link"><?php comments_popup_link( __( 'Leave a comment', 'brunelleschi' ), __( '1 Comment', 'brunelleschi' ), __( '% Comments', 'brunelleschi' ) ); ?></span>
  126. </div><!-- .entry-utility -->
  127. </article><!-- #post-## -->
  128. <?php comments_template( '', true ); ?>
  129. <?php endif; ?>
  130. <?php endwhile; ?>
  131. <?php if ( $wp_query->max_num_pages > 1 ) : ?>
  132. <nav id="nav-below" class="navigation">
  133. <div class="nav-previous"><?php next_posts_link( __( '<span class="meta-nav">&larr;</span> Older posts', 'brunelleschi' ) ); ?></div>
  134. <div class="nav-next"><?php previous_posts_link( __( 'Newer posts <span class="meta-nav">&rarr;</span>', 'brunelleschi' ) ); ?></div>
  135. </nav><!-- #nav-below -->
  136. <?php endif; ?>