Advertisement
Guest User

Coraline: loop.php

a guest
Nov 7th, 2011
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.20 KB | None | 0 0
  1. <?php
  2. /**
  3. * @package WordPress
  4. * @subpackage Coraline
  5. * @since Coraline 1.0
  6. */
  7. ?>
  8.  
  9. <?php /* Display navigation to next/previous pages when applicable */ ?>
  10. <?php if ( $wp_query->max_num_pages > 1 ) : ?>
  11. <div id="nav-above" class="navigation">
  12. <div class="nav-previous"><?php next_posts_link( __( '<span class="meta-nav">&larr;</span> Older posts', 'coraline' ) ); ?></div>
  13. <div class="nav-next"><?php previous_posts_link( __( 'Newer posts <span class="meta-nav">&rarr;</span>', 'coraline' ) ); ?></div>
  14. </div><!-- #nav-above -->
  15. <?php endif; ?>
  16.  
  17. <?php /* If there are no posts to display, such as an empty archive page */ ?>
  18. <?php if ( ! have_posts() ) : ?>
  19. <div id="post-0" class="post error404 not-found">
  20. <h1 class="entry-title"><?php _e( 'Not Found', 'coraline' ); ?></h1>
  21. <div class="entry-content">
  22. <p><?php _e( 'Apologies, but no results were found for the requested archive. Perhaps searching will help find a related post.', 'coraline' ); ?></p>
  23. <?php get_search_form(); ?>
  24. </div><!-- .entry-content -->
  25. </div><!-- #post-0 -->
  26. <?php endif; ?>
  27.  
  28. <?php
  29. // Start the Loop.
  30. $options = get_option( 'coraline_theme_options' ); while ( have_posts() ) : the_post(); ?>
  31.  
  32. <?php /* How to display posts in the Gallery category. */ ?>
  33.  
  34. <?php if ( isset( $options['gallery_category'] ) && '0' != $options['gallery_category'] && in_category( $options['gallery_category'] ) ) : ?>
  35.  
  36. <div id="post-<?php the_ID(); ?>" <?php post_class( 'category-gallery' ); ?>>
  37. <h2 class="entry-title"><a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'coraline' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></a></h2>
  38.  
  39. <div class="entry-meta">
  40. <?php coraline_posted_on(); ?>
  41. </div><!-- .entry-meta -->
  42.  
  43. <div class="entry-content">
  44. <?php if ( post_password_required() ) : ?>
  45. <?php the_content(); ?>
  46. <?php else : ?>
  47. <?php
  48. $images = get_children( array( 'post_parent' => $post->ID, 'post_type' => 'attachment', 'post_mime_type' => 'image', 'orderby' => 'menu_order', 'order' => 'ASC', 'numberposts' => 999 ) );
  49. if ( $images ) :
  50. $total_images = count( $images );
  51. $image = array_shift( $images );
  52. $image_img_tag = wp_get_attachment_image( $image->ID, 'thumbnail' );
  53. ?>
  54. <div class="gallery-thumb">
  55. <a class="size-thumbnail" href="<?php the_permalink(); ?>"><?php echo $image_img_tag; ?></a>
  56. </div><!-- .gallery-thumb -->
  57. <p><em><?php printf( __( 'This gallery contains <a %1$s>%2$s photos</a>.', 'coraline' ),
  58. 'href="' . get_permalink() . '" title="' . sprintf( esc_attr__( 'Permalink to %s', 'coraline' ), the_title_attribute( 'echo=0' ) ) . '" rel="bookmark"',
  59. $total_images
  60. ); ?></em></p>
  61. <?php endif; ?>
  62. <?php the_excerpt(); ?>
  63. <?php endif; ?>
  64. </div><!-- .entry-content -->
  65.  
  66. <div class="entry-info">
  67. <span class="comments-link"><?php comments_popup_link( __( '&rarr; Leave a comment', 'coraline' ), __( '&rarr; 1 Comment', 'coraline' ), __( '&rarr; % Comments', 'coraline' ) ); ?></span>
  68. <p><a href="<?php echo get_term_link( $options['gallery_category'], 'category' ); ?>" title="<?php esc_attr_e( 'View posts in the Gallery category', 'coraline' ); ?>"><?php _e( 'More Galleries', 'coraline' ); ?></a></p>
  69. <p><?php edit_post_link( __( 'Edit', 'coraline' ), '', '' ); ?></p>
  70. </div><!-- .entry-info -->
  71. </div><!-- #post-## -->
  72.  
  73. <?php /* How to display posts in the asides category */ ?>
  74.  
  75. <?php elseif ( isset( $options['aside_category'] ) && '0' != $options['aside_category'] && in_category( $options['aside_category'] ) ) : ?>
  76. <div id="post-<?php the_ID(); ?>" <?php post_class( 'category-asides' ); ?>>
  77.  
  78. <?php if ( is_archive() || is_search() ) : // Display excerpts for archives and search. ?>
  79. <div class="entry-summary aside">
  80. <?php the_excerpt(); ?>
  81. </div><!-- .entry-summary -->
  82. <?php else : ?>
  83. <div class="entry-content aside">
  84. <?php the_content( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'coraline' ) ); ?>
  85. </div><!-- .entry-content -->
  86. <?php endif; ?>
  87.  
  88. <div class="entry-info">
  89. <p class="comments-link"><?php comments_popup_link( __( '&rarr; Leave a comment', 'coraline' ), __( '&rarr; 1 Comment', 'coraline' ), __( '&rarr; % Comments', 'coraline' ) ); ?></p>
  90. <p><?php coraline_posted_on(); ?></p>
  91. <?php edit_post_link( __( 'Edit', 'coraline' ), '', '' ); ?>
  92. </div><!-- .entry-info -->
  93. </div><!-- #post-## -->
  94.  
  95. <?php /* How to display all other posts. */ ?>
  96.  
  97. <?php else : ?>
  98. <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
  99. <h2 class="entry-title"><a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'coraline' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></a></h2>
  100.  
  101. <div class="entry-meta">
  102. <?php coraline_posted_on(); ?><span class="comments-link"><span class="meta-sep">|</span> <?php comments_popup_link( __( 'Leave a comment', 'coraline' ), __( '1 Comment', 'coraline' ), __( '% Comments', 'coraline' ) ); ?></span>
  103. </div><!-- .entry-meta -->
  104.  
  105. <?php if ( is_search() ) : // Display excerpts for search. ?>
  106. <div class="entry-summary">
  107. <?php the_excerpt(); ?>
  108. </div><!-- .entry-summary -->
  109. <?php else : ?>
  110. <div class="entry-content">
  111. <?php the_content( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'coraline' ) ); ?>
  112. <?php wp_link_pages( array( 'before' => '<div class="page-link">' . __( 'Pages:', 'coraline' ), 'after' => '</div>' ) ); ?>
  113. </div><!-- .entry-content -->
  114. <?php endif; ?>
  115.  
  116. <div class="entry-info">
  117. <p class="comments-link"><?php comments_popup_link( __( '&rarr; Leave a comment', 'coraline' ), __( '&rarr; 1 Comment', 'coraline' ), __( '&rarr; % Comments', 'coraline' ) ); ?></p>
  118. <?php if ( count( get_the_category() ) ) : ?>
  119. <p class="cat-links">
  120. <?php printf( __( '<span class="%1$s">Posted in</span> %2$s', 'coraline' ), 'entry-info-prep entry-info-prep-cat-links', get_the_category_list( ', ' ) ); ?>
  121. </p>
  122. <?php endif; ?>
  123. <?php
  124. $tags_list = get_the_tag_list( '', ', ' );
  125. if ( $tags_list ):
  126. ?>
  127. <p class="tag-links">
  128. <?php printf( __( '<span class="%1$s">Tagged</span> %2$s', 'coraline' ), 'entry-info-prep entry-info-prep-tag-links', $tags_list ); ?>
  129. </p>
  130. <?php endif; ?>
  131. <?php edit_post_link( __( 'Edit', 'coraline' ), '<p class="edit-link">', '</p>' ); ?>
  132. </div><!-- .entry-info -->
  133. </div><!-- #post-## -->
  134.  
  135.  
  136.  
  137.  
  138.  
  139.  
  140. <?php comments_template( '', true ); ?>
  141.  
  142. <?php endif; // This was the if statement that broke the loop into three parts based on categories. ?>
  143.  
  144.  
  145.  
  146.  
  147. <?php endwhile; // End the loop. Whew. ?>
  148.  
  149. <?php /* Display navigation to next/previous pages when applicable */ ?>
  150. <?php if ( $wp_query->max_num_pages > 1 ) : ?>
  151. <div id="nav-below" class="navigation">
  152. <div class="nav-previous"><?php next_posts_link( __( '<span class="meta-nav">&larr;</span> Older posts', 'coraline' ) ); ?></div>
  153. <div class="nav-next"><?php previous_posts_link( __( 'Newer posts <span class="meta-nav">&rarr;</span>', 'coraline' ) ); ?></div>
  154. </div><!-- #nav-below -->
  155. <?php endif; ?>
  156.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement