content-portfolio-template.php 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <?php
  2. /**
  3. * The template used for displaying Jetpack Portfolio posts on single porfolio pages
  4. *
  5. * @package Lodestar
  6. */
  7. ?>
  8. <?php
  9. if ( have_posts() ) :
  10. while ( have_posts() ) :
  11. the_post();
  12. ?>
  13. <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
  14. <header class="entry-header">
  15. <?php the_title( '<h1>', '</h1>' ); ?>
  16. </header>
  17. <div class="entry-content">
  18. <?php the_content(); ?>
  19. </div>
  20. </article><!-- #post-<?php the_ID(); ?> -->
  21. <?php
  22. endwhile;
  23. endif;
  24. ?>
  25. <?php if ( ! post_password_required() ) : ?>
  26. <?php
  27. if ( get_query_var( 'paged' ) ) {
  28. $paged = get_query_var( 'paged' );
  29. } elseif ( get_query_var( 'page' ) ) {
  30. $paged = get_query_var( 'page' );
  31. } else {
  32. $paged = 1;
  33. }
  34. /**
  35. * Query projects with a fixed posts-per-page. The category sorting in the template works
  36. * best if all projects are loaded. A limit of 120 makes sure not too many projects are
  37. * loaded at once, and the page speed is helped by lazy loading images.
  38. */
  39. $args = array(
  40. 'post_type' => 'jetpack-portfolio',
  41. 'posts_per_page' => '120',
  42. 'paged' => $paged,
  43. );
  44. $project_query = new WP_Query( $args );
  45. ?>
  46. <div class="portfolio-projects" id="portfolio-projects">
  47. <?php if ( post_type_exists( 'jetpack-portfolio' ) && $project_query->have_posts() ) : ?>
  48. <?php lodestar_project_terms(); ?>
  49. <div class="portfolio-wrapper" id="main">
  50. <?php
  51. while ( $project_query->have_posts() ) :
  52. $project_query->the_post();
  53. ?>
  54. <?php get_template_part( 'components/features/portfolio/content', 'portfolio' ); ?>
  55. <?php endwhile; ?>
  56. </div><!-- .portfolio-wrapper -->
  57. <?php endif; ?>
  58. </div><!-- .portfolio-projects -->
  59. <?php endif; // end post_password_required() ?>