index.php 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. <?php get_header(); ?>
  2. <div id="container">
  3. <div id="content" role="main">
  4. <?php while ( have_posts() ) : the_post(); ?>
  5. <?php /* How to display posts in the Gallery category. */ ?>
  6. <?php if ( in_category( _x('gallery', 'gallery category slug', 'daw') ) ) : ?>
  7. <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
  8. <h2 class="entry-title"><a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'daw' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></a></h2>
  9. <div class="entry-meta">
  10. <?php daw_posted_on(); ?>
  11. </div><!-- .entry-meta -->
  12. <div class="entry-content">
  13. <?php if ( post_password_required() ) : ?>
  14. <?php the_content(); ?>
  15. <?php else : ?>
  16. <?php
  17. $images = get_children( array( 'post_parent' => $post->ID, 'post_type' => 'attachment', 'post_mime_type' => 'image', 'orderby' => 'menu_order', 'order' => 'ASC', 'numberposts' => 999 ) );
  18. if ( $images ) :
  19. $total_images = count( $images );
  20. $image = array_shift( $images );
  21. $image_img_tag = wp_get_attachment_image( $image->ID, 'thumbnail' );
  22. ?>
  23. <div class="gallery-thumb">
  24. <a class="size-thumbnail" href="<?php the_permalink(); ?>"><?php echo $image_img_tag; ?></a>
  25. </div><!-- .gallery-thumb -->
  26. <p><em><?php printf( __( 'This gallery contains <a %1$s>%2$s photos</a>.', 'daw' ),
  27. 'href="' . get_permalink() . '" title="' . sprintf( esc_attr__( 'Permalink to %s', 'daw' ), the_title_attribute( 'echo=0' ) ) . '" rel="bookmark"',
  28. $total_images
  29. ); ?></em></p>
  30. <?php endif; ?>
  31. <?php the_excerpt(); ?>
  32. <?php endif; ?>
  33. </div><!-- .entry-content -->
  34. <div class="entry-utility">
  35. <a href="<?php echo get_term_link( _x('gallery', 'gallery category slug', 'daw'), 'category' ); ?>" title="<?php esc_attr_e( 'View posts in the Gallery category', 'daw' ); ?>"><?php _e( 'More Galleries', 'daw' ); ?></a>
  36. <span class="meta-sep">|</span>
  37. <span class="comments-link"><?php comments_popup_link( __( 'Leave a comment', 'daw' ), __( '1 Comment', 'daw' ), __( '% Comments', 'daw' ) ); ?></span>
  38. <?php edit_post_link( __( 'Edit', 'daw' ), '<span class="meta-sep">|</span> <span class="edit-link">', '</span>' ); ?>
  39. </div><!-- .entry-utility -->
  40. </div><!-- #post-## -->
  41. <?php /* How to display posts in the asides category */ ?>
  42. <?php elseif ( in_category( _x('asides', 'asides category slug', 'daw') ) ) : ?>
  43. <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
  44. <?php if ( is_archive() || is_search() ) : // Display excerpts for archives and search. ?>
  45. <div class="entry-summary">
  46. <?php the_excerpt(); ?>
  47. </div><!-- .entry-summary -->
  48. <?php else : ?>
  49. <div class="entry-content">
  50. <?php the_content( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'daw' ) ); ?>
  51. </div><!-- .entry-content -->
  52. <?php endif; ?>
  53. <div class="entry-utility">
  54. <?php daw_posted_on(); ?>
  55. <span class="meta-sep">|</span>
  56. <span class="comments-link"><?php comments_popup_link( __( 'Leave a comment', 'daw' ), __( '1 Comment', 'daw' ), __( '% Comments', 'daw' ) ); ?></span>
  57. <?php edit_post_link( __( 'Edit', 'daw' ), '<span class="meta-sep">|</span> <span class="edit-link">', '</span>' ); ?>
  58. </div><!-- .entry-utility -->
  59. </div><!-- #post-## -->
  60. <?php /* How to display all other posts. */ ?>
  61. <?php else : ?>
  62. <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
  63. <h2 class="entry-title"><a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'daw' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></a></h2>
  64. <div class="entry-meta">
  65. <?php daw_posted_on(); ?>
  66. </div><!-- .entry-meta -->
  67. <?php if ( is_archive() || is_search() ) : // Only display excerpts for archives and search. ?>
  68. <div class="entry-summary">
  69. <?php the_excerpt(); ?>
  70. </div><!-- .entry-summary -->
  71. <?php else : ?>
  72. <div class="entry-content">
  73. <?php the_content( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'daw' ) ); ?>
  74. <?php wp_link_pages( array( 'before' => '<div class="page-link">' . __( 'Pages:', 'daw' ), 'after' => '</div>' ) ); ?>
  75. </div><!-- .entry-content -->
  76. <?php endif; ?>
  77. <div class="entry-utility">
  78. <?php if ( count( get_the_category() ) ) : ?>
  79. <span class="cat-links">
  80. <?php printf( __( '<span class="%1$s">Posted in</span> %2$s', 'daw' ), 'entry-utility-prep entry-utility-prep-cat-links', get_the_category_list( ', ' ) ); ?>
  81. </span>
  82. <span class="meta-sep">|</span>
  83. <?php endif; ?>
  84. <?php
  85. $tags_list = get_the_tag_list( '', ', ' );
  86. if ( $tags_list ):
  87. ?>
  88. <span class="tag-links">
  89. <?php printf( __( '<span class="%1$s">Tagged</span> %2$s', 'daw' ), 'entry-utility-prep entry-utility-prep-tag-links', $tags_list ); ?>
  90. </span>
  91. <span class="meta-sep">|</span>
  92. <?php endif; ?>
  93. <span class="comments-link"><?php comments_popup_link( __( 'Leave a comment', 'daw' ), __( '1 Comment', 'daw' ), __( '% Comments', 'daw' ) ); ?></span>
  94. <?php edit_post_link( __( 'Edit', 'daw' ), '<span class="meta-sep">|</span> <span class="edit-link">', '</span>' ); ?>
  95. </div><!-- .entry-utility -->
  96. </div><!-- #post-## -->
  97. <?php comments_template( '', true ); ?>
  98. <?php endif; // This was the if statement that broke the loop into three parts based on categories. ?>
  99. <?php endwhile; // End the loop. Whew. ?>
  100. <?php /* Display navigation to next/previous pages when applicable */ ?>
  101. <?php if ( $wp_query->max_num_pages > 1 ) : ?>
  102. <div id="nav-below" class="navigation">
  103. <div class="nav-previous"><?php next_posts_link( __( '<span class="meta-nav">&larr;</span> Older posts', 'daw' ) ); ?></div>
  104. <div class="nav-next"><?php previous_posts_link( __( 'Newer posts <span class="meta-nav">&rarr;</span>', 'daw' ) ); ?></div>
  105. </div><!-- #nav-below -->
  106. <?php endif; ?>
  107. </div><!-- #content -->
  108. </div><!-- #container -->
  109. <?php get_sidebar(); ?>
  110. <?php get_footer(); ?>