1. <?php
  2. /**
  3. * This template displays portfolio post content
  4. *
  5. * @package Portfolio Press
  6. */
  7.  
  8. if ( post_password_required() ) {
  9. echo get_the_password_form();
  10. } else {
  11. // Set the size of the thumbnails and content width
  12. $fullwidth = false;
  13. if ( of_get_option( 'portfolio_sidebar' ) || is_page_template('full-width-portfolio.php') )
  14. $fullwidth = true;
  15.  
  16. $thumbnail = 'portfolio-thumbnail';
  17.  
  18. if ( $fullwidth )
  19. $thumbnail = 'portfolio-thumbnail-fullwidth';
  20.  
  21. // This displays the portfolio full width, but doesn't change thumbnail sizes
  22. if ( of_get_option('layout','layout-2cr') == 'layout-1col' )
  23. $fullwidth = true;
  24.  
  25. // Query posts if this is being used as a page template
  26. if ( is_page_template() ) {
  27.  
  28. global $paged;
  29.  
  30. if ( get_query_var( 'paged' ) )
  31. $paged = get_query_var( 'paged' );
  32. elseif ( get_query_var( 'page' ) )
  33. $paged = get_query_var( 'page' );
  34. else
  35. $paged = 1;
  36.  
  37. $args = array(
  38. 'post_type' => 'portfolio',
  39. 'posts_per_page' => 9,
  40. 'paged' => $paged );
  41. query_posts( $args );
  42. }
  43. ?>
  44. <div id="portfolio"<?php if ( $fullwidth ) { echo ' class="full-width"'; }?>>
  45.  
  46. <?php if ( is_tax() ): ?>
  47. <header class="entry-header">
  48. <h1 class="entry-title"><?php echo single_cat_title( '', false ); ?></h1>
  49. <?php $categorydesc = category_description(); if ( ! empty( $categorydesc ) ) echo apply_filters( 'archive_meta', '<div class="archive-meta">' . $categorydesc . '</div>' ); ?>
  50. </header>
  51.  
  52. <?php endif; ?>
  53.  
  54. <?php if ( have_posts() ) : $count = 0;
  55. while ( have_posts() ) : the_post(); $count++;
  56. $classes = 'portfolio-item item-' . $count;
  57. if ( $count % 3 == 0 ) {
  58. $classes .= ' ie-col3';
  59. }
  60. if ( !has_post_thumbnail() ) {
  61. $classes .= ' no-thumb';
  62. } ?>
  63. <div class="<?php echo $classes; ?>">
  64. <?php if ( has_post_thumbnail() ) { ?>
  65. <a href="<?php the_permalink() ?>" rel="bookmark" title="<?php _e( 'Permanent Link to', 'portfoliopress' ); ?><?php the_title_attribute(); ?>" class="thumb"><?php the_post_thumbnail( $thumbnail ); ?></a>
  66. <?php } ?>
  67. <a href="<?php the_permalink() ?>" rel="bookmark" title="<?php _e( 'Permanent Link to', 'portfoliopress' ); ?> <?php the_title_attribute(); ?>" class="title-overlay"><?php the_title() ?></a>
  68. </div>
  69.  
  70. <?php endwhile; ?>
  71. <?php if ( ! dynamic_sidebar( 'below_portfolio_images' ) ) :
  72. endif;
  73. ?>
  74.  
  75. <?php portfoliopress_content_nav(); ?>
  76.  
  77. <?php else: ?>
  78.  
  79. <h2 class="title"><?php _e( 'Sorry, no posts matched your criteria.', 'portfoliopress' ) ?></h2>
  80.  
  81. <?php endif; ?>
  82.  
  83. </div><!-- #portfolio -->
  84. <?php } ?>