PageRenderTime 40ms CodeModel.GetById 13ms RepoModel.GetById 0ms app.codeStats 0ms

/wp-content/themes/WP960gs-master/loop.php

https://github.com/racs182/Cloud_hosting_pagoda
PHP | 139 lines | 123 code | 16 blank | 0 comment | 26 complexity | fe970f802793ff5eaedbf53103e91f3e MD5 | raw file
Possible License(s): LGPL-2.1, GPL-2.0, AGPL-1.0
  1. <?php /* Display navigation to next/previous pages when applicable */ ?>
  2. <?php if ( $wp_query->max_num_pages > 1 ) : ?>
  3. <div id="nav-above" class="navigation">
  4. <div class="nav-previous"><?php next_posts_link( __( '<span class="meta-nav">&larr;</span> Older posts', 'twentyten' ) ); ?></div>
  5. <div class="nav-next"><?php previous_posts_link( __( 'Newer posts <span class="meta-nav">&rarr;</span>', 'twentyten' ) ); ?></div>
  6. </div><!-- #nav-above -->
  7. <?php endif; ?>
  8. <?php if ( ! have_posts() ) : ?>
  9. <div id="post-0" class="post error404 not-found">
  10. <h1 class="entry-title"><?php _e( 'Not Found', 'twentyten' ); ?></h1>
  11. <div class="entry-content">
  12. <p><?php _e( 'Apologies, but no results were found for the requested archive. Perhaps searching will help find a related post.', 'twentyten' ); ?></p>
  13. <?php get_search_form(); ?>
  14. </div><!-- .entry-content -->
  15. </div><!-- #post-0 -->
  16. <?php endif; ?>
  17. <?php while ( have_posts() ) : the_post(); ?>
  18. <?php if ( ( function_exists( 'get_post_format' ) && 'gallery' == get_post_format( $post->ID ) ) || in_category( _x( 'gallery', 'gallery category slug', 'twentyten' ) ) ) : ?>
  19. <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
  20. <h2 class="entry-title"><a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'twentyten' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></a></h2>
  21. <div class="entry-meta">
  22. <?php twentyten_posted_on(); ?>
  23. </div><!-- .entry-meta -->
  24. <div class="entry-content">
  25. <?php if ( post_password_required() ) : ?>
  26. <?php the_content(); ?>
  27. <?php else : ?>
  28. <?php
  29. $images = get_children( array( 'post_parent' => $post->ID, 'post_type' => 'attachment', 'post_mime_type' => 'image', 'orderby' => 'menu_order', 'order' => 'ASC', 'numberposts' => 999 ) );
  30. if ( $images ) :
  31. $total_images = count( $images );
  32. $image = array_shift( $images );
  33. $image_img_tag = wp_get_attachment_image( $image->ID, 'thumbnail' );
  34. ?>
  35. <div class="gallery-thumb">
  36. <a class="size-thumbnail" href="<?php the_permalink(); ?>"><?php echo $image_img_tag; ?></a>
  37. </div><!-- .gallery-thumb -->
  38. <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, 'twentyten' ),
  39. 'href="' . get_permalink() . '" title="' . sprintf( esc_attr__( 'Permalink to %s', 'twentyten' ), the_title_attribute( 'echo=0' ) ) . '" rel="bookmark"',
  40. number_format_i18n( $total_images )
  41. ); ?></em></p>
  42. <?php endif; ?>
  43. <?php the_excerpt(); ?>
  44. <?php endif; ?>
  45. </div><!-- .entry-content -->
  46. <div class="entry-utility">
  47. <?php if ( function_exists( 'get_post_format' ) && 'gallery' == get_post_format( $post->ID ) ) : ?>
  48. <a href="<?php echo get_post_format_link( 'gallery' ); ?>" title="<?php esc_attr_e( 'View Galleries', 'twentyten' ); ?>"><?php _e( 'More Galleries', 'twentyten' ); ?></a>
  49. <span class="meta-sep">|</span>
  50. <?php elseif ( in_category( _x( 'gallery', 'gallery category slug', 'twentyten' ) ) ) : ?>
  51. <a href="<?php echo get_term_link( _x( 'gallery', 'gallery category slug', 'twentyten' ), 'category' ); ?>" title="<?php esc_attr_e( 'View posts in the Gallery category', 'twentyten' ); ?>"><?php _e( 'More Galleries', 'twentyten' ); ?></a>
  52. <span class="meta-sep">|</span>
  53. <?php endif; ?>
  54. <span class="comments-link"><?php comments_popup_link( __( 'Leave a comment', 'twentyten' ), __( '1 Comment', 'twentyten' ), __( '% Comments', 'twentyten' ) ); ?></span>
  55. <?php edit_post_link( __( 'Edit', 'twentyten' ), '<span class="meta-sep">|</span> <span class="edit-link">', '</span>' ); ?>
  56. </div><!-- .entry-utility -->
  57. </div><!-- #post-## -->
  58. <?php /* How to display posts of the Aside format. The asides category is the old way. */ ?>
  59. <?php elseif ( ( function_exists( 'get_post_format' ) && 'aside' == get_post_format( $post->ID ) ) || in_category( _x( 'asides', 'asides category slug', 'twentyten' ) ) ) : ?>
  60. <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
  61. <?php if ( is_archive() || is_search() ) : // Display excerpts for archives and search. ?>
  62. <div class="entry-summary">
  63. <?php the_excerpt(); ?>
  64. </div><!-- .entry-summary -->
  65. <?php else : ?>
  66. <div class="entry-content">
  67. <?php the_content( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'twentyten' ) ); ?>
  68. </div><!-- .entry-content -->
  69. <?php endif; ?>
  70. <div class="entry-utility">
  71. <?php twentyten_posted_on(); ?>
  72. <span class="meta-sep">|</span>
  73. <span class="comments-link"><?php comments_popup_link( __( 'Leave a comment', 'twentyten' ), __( '1 Comment', 'twentyten' ), __( '% Comments', 'twentyten' ) ); ?></span>
  74. <?php edit_post_link( __( 'Edit', 'twentyten' ), '<span class="meta-sep">|</span> <span class="edit-link">', '</span>' ); ?>
  75. </div><!-- .entry-utility -->
  76. </div><!-- #post-## -->
  77. <?php /* How to display all other posts. */ ?>
  78. <?php else : ?>
  79. <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
  80. <h2 class="entry-title"><a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'twentyten' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></a></h2>
  81. <div class="entry-meta">
  82. <?php twentyten_posted_on(); ?>
  83. </div><!-- .entry-meta -->
  84. <?php if ( is_archive() || is_search() ) : // Only display excerpts for archives and search. ?>
  85. <div class="entry-summary">
  86. <?php the_excerpt(); ?>
  87. </div><!-- .entry-summary -->
  88. <?php else : ?>
  89. <div class="entry-content">
  90. <?php the_content( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'twentyten' ) ); ?>
  91. <?php wp_link_pages( array( 'before' => '<div class="page-link">' . __( 'Pages:', 'twentyten' ), 'after' => '</div>' ) ); ?>
  92. </div><!-- .entry-content -->
  93. <?php endif; ?>
  94. <div class="entry-utility">
  95. <?php if ( count( get_the_category() ) ) : ?>
  96. <span class="cat-links">
  97. <?php printf( __( '<span class="%1$s">Posted in</span> %2$s', 'twentyten' ), 'entry-utility-prep entry-utility-prep-cat-links', get_the_category_list( ', ' ) ); ?>
  98. </span>
  99. <span class="meta-sep">|</span>
  100. <?php endif; ?>
  101. <?php
  102. $tags_list = get_the_tag_list( '', ', ' );
  103. if ( $tags_list ):
  104. ?>
  105. <span class="tag-links">
  106. <?php printf( __( '<span class="%1$s">Tagged</span> %2$s', 'twentyten' ), 'entry-utility-prep entry-utility-prep-tag-links', $tags_list ); ?>
  107. </span>
  108. <span class="meta-sep">|</span>
  109. <?php endif; ?>
  110. <span class="comments-link"><?php comments_popup_link( __( 'Leave a comment', 'twentyten' ), __( '1 Comment', 'twentyten' ), __( '% Comments', 'twentyten' ) ); ?></span>
  111. <?php edit_post_link( __( 'Edit', 'twentyten' ), '<span class="meta-sep">|</span> <span class="edit-link">', '</span>' ); ?>
  112. </div><!-- .entry-utility -->
  113. </div><!-- #post-## -->
  114. <?php comments_template( '', true ); ?>
  115. <?php endif; // This was the if statement that broke the loop into three parts based on categories. ?>
  116. <?php endwhile; // End the loop. Whew. ?>
  117. <?php /* Display navigation to next/previous pages when applicable */ ?>
  118. <?php if ( $wp_query->max_num_pages > 1 ) : ?>
  119. <div id="nav-below" class="navigation">
  120. <div class="nav-previous"><?php next_posts_link( __( '<span class="meta-nav">&larr;</span> Older posts', 'twentyten' ) ); ?></div>
  121. <div class="nav-next"><?php previous_posts_link( __( 'Newer posts <span class="meta-nav">&rarr;</span>', 'twentyten' ) ); ?></div>
  122. </div><!-- #nav-below -->
  123. <?php endif; ?>