Advertisement
Guest User

loop php

a guest
Aug 16th, 2012
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.39 KB | None | 0 0
  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 Revolution
  18. * @since Revolution 1.0
  19. */
  20. ?>
  21.  
  22. <?php /* If there are no posts to display, such as an empty archive page */ ?>
  23. <?php if ( ! have_posts() ) : ?>
  24. <article id="post-0" class="post error404 not-found">
  25. <h1 class="posttitle"><?php _e( 'Not Found', 'templatesquare' ); ?></h1>
  26. <div class="entry">
  27. <p><?php _e( 'Apologies, but no results were found for the requested archive. Perhaps searching will help find a related post.', 'templatesquare' ); ?></p>
  28. <?php get_search_form(); ?>
  29. </div>
  30. </article>
  31. <?php endif; ?>
  32.  
  33.  
  34. <?php while ( have_posts() ) : the_post(); ?>
  35.  
  36. <?php /* How to display all posts. */ ?>
  37. <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
  38.  
  39.  
  40. <?php
  41.  
  42. if(!is_search()){
  43.  
  44. ?>
  45.  
  46. <div class="entry-utility">
  47. <div class="posttime"><span><?php the_time('M d') ?></span><?php the_time('Y') ?></div>
  48. <div class="postcom"><?php comments_popup_link(__('<span>No</span> Comments', 'templatesquare'), __('<span>1</span> Comments', 'templatesquare'), __('<span>%</span> Comments', 'templatesquare'), '' , __('<span class="commoff">Comments<br/>off</span> ', 'templatesquare')); ?></div>
  49. </div>
  50.  
  51. <?php
  52.  
  53. }
  54.  
  55. ?>
  56.  
  57. <div class="entry-content">
  58.  
  59. <?php
  60. $custom = get_post_custom($post->ID);
  61. $cf_thumb = (isset($custom["thumb"][0]))? $custom["thumb"][0] : "";
  62.  
  63. if($cf_thumb!=""){
  64. $thumb = '<div class="postimg"><img src='. $cf_thumb .' alt="" class="scale-with-grid"/></div>';
  65. }elseif(has_post_thumbnail($post->ID) ){
  66. $thumb = '<div class="postimg">'.get_the_post_thumbnail($post->ID, 'post-blog', array('alt' => '', 'class' => 'scale-with-grid')).'</div>';
  67. }else{
  68. $thumb ="";
  69. }
  70. ?>
  71.  
  72.  
  73. <?php
  74. if(!is_search()){
  75. echo $thumb;
  76. }
  77. ?>
  78.  
  79. <h2 class="posttitle">
  80. <a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'templatesquare' ), the_title_attribute( 'echo=0' ) ); ?>" data-rel="bookmark"><?php the_title(); ?></a>
  81. </h2>
  82. <?php the_content(__('Continue Reading &rarr;', 'templatesquare')); ?>
  83. </div>
  84. <div class="clear"></div>
  85.  
  86. </article><!-- end post -->
  87.  
  88. <?php comments_template( '', true ); ?>
  89.  
  90. <?php endwhile; // End the loop. Whew. ?>
  91.  
  92.  
  93. <div class="pagenavi">
  94. <?php paginate();?>
  95. </div>
  96.  
  97. <?php wp_reset_query();?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement