Advertisement
debbie_gadbois

loop-taxonomy.php

Aug 22nd, 2014
23
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.65 KB | None | 0 0
  1. <?php
  2. /**
  3. * The loop that displays posts.
  4. * You can override this file in your active theme.
  5. *
  6. * The loop displays the posts and the post content. See
  7. * http://codex.wordpress.org/The_Loop to understand it and
  8. * http://codex.wordpress.org/Template_Tags to understand
  9. * the tags used in it.
  10. *
  11. * This can be overridden in child themes with loop.php or
  12. * loop-template.php, where 'template' is the loop context
  13. * requested by a template. For example, loop-index.php would
  14. * be used if it exists and we ask for the loop with:
  15. * <code>get_template_part( 'loop', 'index' );</code>
  16. *
  17. * @package Directory
  18. * @subpackage Author
  19. * @since Directory 2.2
  20. */
  21.  
  22. global $post, $wp_query, $query_string, $Directory_Core;
  23.  
  24. $dr = $Directory_Core;
  25. ?>
  26.  
  27. <?php /* Display navigation to next/previous pages when applicable */ ?>
  28. <?php echo $dr->pagination( $dr->pagination_top );
  29.  
  30. //breadcrumbs
  31. if ( ! is_post_type_archive('directory_listing') ): ?>
  32.  
  33. <div class="breadcrumbtrail">
  34. <p class="page-title dp-taxonomy-name"><?php the_dr_breadcrumbs(); ?></p>
  35. <div class="clear"></div>
  36. </div>
  37. <?php endif; ?>
  38. <div class="clear"></div>
  39. <?php /* If there are no posts to display, such as an empty archive page */ ?>
  40. <?php if ( ! have_posts() ) : ?>
  41. <div id="post-0" class="post error404 not-found">
  42. <h1 class="entry-title"><?php _e( 'Not Found', DR_TEXT_DOMAIN ); ?></h1>
  43. <div class="entry-content">
  44. <p><?php _e( 'Apologies, but no results were found for the requested directory. Perhaps searching will help find a related listing.', DR_TEXT_DOMAIN ); ?></p>
  45. <?php get_search_form(); ?>
  46. </div><!-- .entry-content -->
  47. </div><!-- #post-0 -->
  48.  
  49.  
  50. <?php
  51. /* Start the Loop.
  52. *
  53. * In Twenty Ten we use the same loop in multiple contexts.
  54. * It is broken into three main parts: when we're displaying
  55. * posts that are in the gallery category, when we're displaying
  56. * posts in the asides category, and finally all other posts.
  57. *
  58. * Additionally, we sometimes check for whether we are on an
  59. * archive page, a search page, etc., allowing for small differences
  60. * in the loop on each template without actually duplicating
  61. * the rest of the loop that is shared.
  62. *
  63. * Without further ado, the loop:
  64. */
  65.  
  66. $last = $wp_query->post_count;
  67. $count = 1;
  68.  
  69. ?>
  70. <div id="dr_listing_list">
  71.  
  72. <?php while ( have_posts() ) : the_post();
  73. // Retrieves categories list of current post, separated by commas.
  74. $categories_list = get_the_category_list( __(', ',DR_TEXT_DOMAIN),'');
  75. // Retrieves tag list of current post, separated by commas.
  76. $tags_list = get_the_tag_list('', __(', ',DR_TEXT_DOMAIN), '');
  77.  
  78. //add last css class for styling grids
  79. if ( $count == $last )
  80. $class = 'dr_listing last-listing';
  81. else
  82. $class = 'dr_listing';
  83.  
  84. ?>
  85. <div class="<?php echo $class ?>">
  86. <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
  87.  
  88. <div class="entry-post">
  89. <h2 class="entry-title">
  90. <a href="<?php echo the_permalink(); ?>" title="<?php echo sprintf( esc_attr__( 'Permalink to %s', DR_TEXT_DOMAIN ), get_the_title() ); ?>" rel="bookmark"><?php the_title();?></a>
  91. </h2>
  92.  
  93. <div class="entry-meta">
  94. <?php the_dr_posted_on(); ?>
  95. <div class="entry-utility">
  96. <?php if ( $categories_list ): ?>
  97. <span class="cat-links"><?php echo sprintf( __( '<span class="%1$s">Posted in</span> %2$s', DR_TEXT_DOMAIN ), 'entry-utility-prep entry-utility-prep-cat-links', $categories_list ); ?></span><br />
  98. <?php
  99. unset( $categories_list );
  100. endif;
  101. if ( $tags_list ): ?>
  102. <span class="tag-links"><?php echo sprintf ( __( '<span class="%1$s">Tagged</span> %2$s', DR_TEXT_DOMAIN ), 'entry-utility-prep entry-utility-prep-tag-links', $tags_list ); ?></span><br />
  103. <?php
  104. unset( $tags_list );
  105. endif;
  106. do_action( 'sr_avg_ratings_of_listings', get_the_ID() ); ?>
  107. <br /><span class="comments-link"><?php comments_popup_link( __( 'Leave a review', DR_TEXT_DOMAIN ), __( '1 Review', DR_TEXT_DOMAIN ), esc_attr__( '% Reviews', DR_TEXT_DOMAIN ), '', __( 'Reviews Off', DR_TEXT_DOMAIN ) ); ?></span>
  108. </div>
  109. </div>
  110.  
  111. <div class="entry-summary">
  112.  
  113. <?php if (has_post_thumbnail()): ?>
  114. <a href="<?php the_permalink(); ?>">
  115. <?php the_post_thumbnail( array(50,50), array('class' => 'alignleft dr_listing_image_listing', 'title' => get_the_title(),) ); ?>
  116. </a>
  117. <?php
  118. endif;
  119. the_excerpt();
  120. ?>
  121. </div>
  122. <div class="clear"></div>
  123. </div><!-- .entry-post -->
  124.  
  125. <?php $count++;
  126. ?>
  127. </div><!-- #post-## -->
  128. </div>
  129. <?php endwhile; ?>
  130. </div>
  131.  
  132. <?php /* Display navigation to next/previous pages when applicable */ ?>
  133. <?php echo $dr->pagination( $dr->pagination_bottom ); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement