content-portfolio-template.php 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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() ) : the_post(); ?>
  11. <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
  12. <header class="entry-header">
  13. <?php the_title( '<h1>', '</h1>' ); ?>
  14. </header>
  15. <div class="entry-content">
  16. <?php the_content(); ?>
  17. </div>
  18. </article><!-- #post-<?php the_ID(); ?> -->
  19. <?php endwhile;
  20. endif;
  21. ?>
  22. <?php
  23. if ( get_query_var( 'paged' ) ) {
  24. $paged = get_query_var( 'paged' );
  25. } elseif ( get_query_var( 'page' ) ) {
  26. $paged = get_query_var( 'page' );
  27. } else {
  28. $paged = 1;
  29. }
  30. /**
  31. * Query projects with a fixed posts-per-page. The category sorting in the template works
  32. * best if all projects are loaded. A limit of 120 makes sure not too many projects are
  33. * loaded at once, and the page speed is helped by lazy loading images.
  34. */
  35. $args = array(
  36. 'post_type' => 'jetpack-portfolio',
  37. 'posts_per_page' => '120',
  38. 'paged' => $paged,
  39. );
  40. $project_query = new WP_Query ( $args );
  41. ?>
  42. <div class="portfolio-projects" id="portfolio-projects">
  43. <?php if ( post_type_exists( 'jetpack-portfolio' ) && $project_query -> have_posts() ) : ?>
  44. <?php lodestar_project_terms(); ?>
  45. <div class="portfolio-wrapper" id="main">
  46. <?php while ( $project_query -> have_posts() ) : $project_query -> the_post(); ?>
  47. <?php get_template_part( 'components/features/portfolio/content', 'portfolio' ); ?>
  48. <?php endwhile; ?>
  49. </div><!-- .portfolio-wrapper -->
  50. <?php endif; ?>
  51. </div><!-- .portfolio-projects -->