Advertisement
Guest User

Untitled

a guest
Mar 9th, 2013
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. /**
  3. * The loop that displays posts.
  4. *
  5. * The loop displays the posts and the post content. See
  6. * http://codex.wordpress.org/The_Loop to understand it and
  7. * http://codex.wordpress.org/Template_Tags to understand
  8. * the tags used in it.
  9. *
  10. * This can be overridden in child themes with loop.php or
  11. * loop-template.php, where 'template' is the loop context
  12. * requested by a template. For example, loop-index.php would
  13. * be used if it exists and we ask for the loop with:
  14. * <code>get_template_part( 'loop', 'index' );</code>
  15. *
  16. * @package WordPress
  17. * @subpackage Adventure_Journal
  18. */
  19.  
  20. $themeOpts = get_option('ctx-adventurejournal-options');
  21. ?>
  22.  
  23. <?php /* Display navigation to next/previous pages when applicable */ ?>
  24. <?php if ( $wp_query->max_num_pages > 1 ) : ?>
  25. <div id="nav-above" class="navigation">
  26. <div class="nav-previous"><?php next_posts_link( __( '<span class="meta-nav">&laquo;</span> Older posts', 'adventurejournal' ) ); ?></div>
  27. <div class="nav-next"><?php previous_posts_link( __( 'Newer posts <span class="meta-nav">&raquo;</span>', 'adventurejournal' ) ); ?></div>
  28. <div class="clear"></div>
  29. </div><!-- #nav-above -->
  30. <?php endif; ?>
  31.  
  32. <?php /* If there are no posts to display, such as an empty archive page */ ?>
  33. <?php if ( ! have_posts() ) : ?>
  34. <div id="post-0" class="post error404 not-found">
  35. <h1 class="entry-title"><?php _e( 'Not Found', 'adventurejournal' ); ?></h1>
  36. <div class="entry-content">
  37. <p><?php _e( 'Apologies, but no results were found for the requested archive. Perhaps searching will help find a related post.', 'adventurejournal' ); ?></p>
  38. <?php get_search_form(); ?>
  39. </div><!-- .entry-content -->
  40. </div><!-- #post-0 -->
  41. <?php endif; ?>
  42.  
  43. <?php
  44. /* Start the Loop.
  45. *
  46. * In Twenty Ten we use the same loop in multiple contexts.
  47. * It is broken into three main parts: when we're displaying
  48. * posts that are in the gallery category, when we're displaying
  49. * posts in the asides category, and finally all other posts.
  50. *
  51. * Additionally, we sometimes check for whether we are on an
  52. * archive page, a search page, etc., allowing for small differences
  53. * in the loop on each template without actually duplicating
  54. * the rest of the loop that is shared.
  55. *
  56. * Without further ado, the loop:
  57. */ ?>
  58. <?php while ( have_posts() ) : the_post(); ?>
  59.  
  60. <?php /* How to display posts in the Gallery category. */ ?>
  61.  
  62. <?php if ( in_category( _x('gallery', 'gallery category slug', 'adventurejournal') ) ) : ?>
  63. <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
  64. <?php edit_post_link( __( 'Edit', 'adventurejournal' ), '<span class="edit-link">', '</span>' ); ?>
  65. <h2 class="entry-title"><a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'adventurejournal' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></a></h2>
  66.  
  67. <div class="entry-meta">
  68. <?php ctx_aj_posted_on(); ?>
  69. </div><!-- .entry-meta -->
  70.  
  71. <div class="entry-content">
  72. <?php if ( post_password_required() ) : ?>
  73. <?php the_content(); ?>
  74. <?php else : ?>
  75. <div class="gallery-thumb">
  76. <?php
  77. $images = get_children( array( 'post_parent' => $post->ID, 'post_type' => 'attachment', 'post_mime_type' => 'image', 'orderby' => 'menu_order', 'order' => 'ASC', 'numberposts' => 999 ) );
  78. $total_images = count( $images );
  79. $image = array_shift( $images );
  80. $image_img_tag = wp_get_attachment_image( $image->ID, 'thumbnail' );
  81. ?>
  82. <a class="size-thumbnail" href="<?php the_permalink(); ?>"><?php echo $image_img_tag; ?></a>
  83. </div><!-- .gallery-thumb -->
  84. <p><em><?php printf( __( 'This gallery contains <a %1$s>%2$s photos</a>.', 'adventurejournal' ),
  85. 'href="' . get_permalink() . '" title="' . sprintf( esc_attr__( 'Permalink to %s', 'adventurejournal' ), the_title_attribute( 'echo=0' ) ) . '" rel="bookmark"',
  86. $total_images
  87. ); ?></em></p>
  88.  
  89. <?php the_excerpt(); ?>
  90. <?php endif; ?>
  91. <div class="clear"></div>
  92. </div><!-- .entry-content -->
  93.  
  94. <div class="entry-utility">
  95. <a href="<?php echo get_term_link( _x('gallery', 'gallery category slug', 'adventurejournal'), 'category' ); ?>" title="<?php esc_attr_e( 'View posts in the Gallery category', 'adventurejournal' ); ?>"><?php _e( 'More Galleries', 'adventurejournal' ); ?></a>
  96. <span class="meta-sep">|</span>
  97. <span class="comments-link"><?php comments_popup_link( __( 'Leave a comment', 'adventurejournal' ), __( '1 Comment', 'adventurejournal' ), __( '% Comments', 'adventurejournal' ) ); ?></span>
  98.  
  99. </div><!-- .entry-utility -->
  100. </div><!-- #post-## -->
  101.  
  102. <?php /* How to display posts in the asides category */ ?>
  103.  
  104. <?php elseif ( in_category( _x('asides', 'asides category slug', 'adventurejournal') ) ) : ?>
  105. <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
  106. <?php edit_post_link( __( 'Edit', 'adventurejournal' ), '<span class="edit-link">', '</span>' ); ?>
  107. <?php if ( is_archive() || is_search() ) : // Display excerpts for archives and search. ?>
  108. <div class="entry-summary">
  109. <?php the_excerpt(); ?>
  110. </div><!-- .entry-summary -->
  111. <?php else : ?>
  112. <div class="entry-content">
  113. <?php the_content( __( 'Read more <span class="meta-nav">&raquo;</span>', 'adventurejournal' ) ); ?>
  114. <div class="clear"></div>
  115. </div><!-- .entry-content -->
  116. <?php endif; ?>
  117.  
  118. <div class="entry-utility">
  119. <?php ctx_aj_posted_on(); ?>
  120. <span class="meta-sep">|</span>
  121. <span class="comments-link"><?php comments_popup_link( __( 'Leave a comment', 'adventurejournal' ), __( '1 Comment', 'adventurejournal' ), __( '% Comments', 'adventurejournal' ) ); ?></span>
  122.  
  123. </div><!-- .entry-utility -->
  124. </div><!-- #post-## -->
  125.  
  126. <?php /* How to display all other posts. */ ?>
  127.  
  128. <?php else : ?>
  129. <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
  130. <?php
  131. $myclasses=join(' ',get_post_class('',$id));
  132. if( preg_match('/sticky/',$myclasses) > 0 ){
  133. echo '<div class="tape tr">&nbsp;</div><div class="tape bl">&nbsp;</div>';
  134. }
  135. ?>
  136. <?php edit_post_link( __( 'Edit', 'adventurejournal' ), '<span class="edit-link">', '</span>' ); ?>
  137. <h2 class="entry-title"><a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'adventurejournal' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></a></h2>
  138. <?php if(is_home() && has_post_thumbnail() && $themeOpts['featured-header']!='true' ) the_post_thumbnail(); ?>
  139. <div class="entry-meta">
  140. <?php ctx_aj_posted_on(); ?>
  141. </div><!-- .entry-meta -->
  142.  
  143. <?php if ( is_archive() || is_search() ) : // Only display excerpts for archives and search. ?>
  144. <div class="entry-summary">
  145. <?php the_excerpt(); ?>
  146. </div><!-- .entry-summary -->
  147. <?php else : ?>
  148. <div class="entry-content">
  149. <?php the_content( __( 'Read more <span class="meta-nav">&raquo;</span>', 'adventurejournal' ) ); ?>
  150. <?php wp_link_pages( array( 'before' => '<div class="page-link">' . __( 'Post pages:', 'adventurejournal' ), 'after' => '</div>' ) ); ?>
  151. <div class="clear"></div>
  152. </div><!-- .entry-content -->
  153. <?php endif; ?>
  154.  
  155. <div class="entry-utility">
  156. <?php if ( count( get_the_category() ) ) : ?>
  157. <span class="cat-links">
  158. <?php printf( __( '<span class="%1$s">Categories: </span> %2$s', 'adventurejournal' ), 'entry-utility-prep entry-utility-prep-cat-links', get_the_category_list( ', ' ) ); ?>
  159. </span>
  160. <span class="meta-sep">|</span>
  161. <?php endif; ?>
  162. <?php
  163. $tags_list = get_the_tag_list( '', ', ' );
  164. if ( $tags_list ):
  165. ?>
  166. <span class="tag-links">
  167. <?php printf( __( '<span class="%1$s">Tags:</span> %2$s', 'adventurejournal' ), 'entry-utility-prep entry-utility-prep-tag-links', $tags_list ); ?>
  168. </span>
  169. <span class="meta-sep">|</span>
  170. <?php endif; ?>
  171. <span class="comments-link"><?php comments_popup_link( __( 'Leave a comment', 'adventurejournal' ), __( '1 Comment', 'adventurejournal' ), __( '% Comments', 'adventurejournal' ) ); ?></span>
  172.  
  173. </div><!-- .entry-utility -->
  174. </div><!-- #post-## -->
  175.  
  176. <?php comments_template( '', true ); ?>
  177.  
  178. <?php endif; // This was the if statement that broke the loop into three parts based on categories. ?>
  179.  
  180. <?php endwhile; // End the loop. Whew. ?>
  181.  
  182. <?php /* Display navigation to next/previous pages when applicable */ ?>
  183. <?php if ( $wp_query->max_num_pages > 1 ) : ?>
  184. <div id="nav-below" class="navigation">
  185. <div class="nav-previous"><?php next_posts_link( __( '<span class="meta-nav">&laquo;</span> Older posts', 'adventurejournal' ) ); ?></div>
  186. <div class="nav-next"><?php previous_posts_link( __( 'Newer posts <span class="meta-nav">&raquo;</span>', 'adventurejournal' ) ); ?></div>
  187. </div><!-- #nav-below -->
  188. <?php endif; ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement