portfolio-page.php 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. <?php
  2. /**
  3. * Template Name: Portfolio Page Template
  4. *
  5. * @package illustratr
  6. */
  7. get_header(); ?>
  8. <div id="primary" class="content-area">
  9. <main id="main" class="site-main" role="main">
  10. <?php if ( post_password_required() ) : ?>
  11. <?php the_title( '<header class="page-header"><h1 class="page-title">', '</h1></header>' ); ?>
  12. <div class="page-content">
  13. <?php the_content(); ?>
  14. </div><!-- .page-content -->
  15. <?php else : ?>
  16. <?php if ( ! get_theme_mod( 'illustratr_hide_portfolio_page_content' ) ) : ?>
  17. <?php
  18. while ( have_posts() ) :
  19. the_post();
  20. ?>
  21. <?php if ( '' != get_the_post_thumbnail() ) : ?>
  22. <div class="entry-thumbnail">
  23. <?php the_post_thumbnail( 'illustratr-featured-image' ); ?>
  24. </div><!-- .entry-thumbnail -->
  25. <?php endif; ?>
  26. <?php the_title( '<header class="page-header"><h1 class="page-title">', '</h1></header>' ); ?>
  27. <div class="page-content">
  28. <?php
  29. the_content();
  30. wp_link_pages(
  31. array(
  32. 'before' => '<div class="page-links"><span class="page-links-title">' . __( 'Pages:', 'illustratr' ) . '</span>',
  33. 'after' => '</div>',
  34. 'link_before' => '<span>',
  35. 'link_after' => '</span>',
  36. )
  37. );
  38. ?>
  39. </div><!-- .page-content -->
  40. <?php edit_post_link( __( 'Edit', 'illustratr' ), '<div class="entry-meta"><span class="edit-link">', '</span></div>' ); ?>
  41. <?php endwhile; // end of the loop. ?>
  42. <?php endif; ?>
  43. <?php
  44. if ( get_query_var( 'paged' ) ) :
  45. $paged = get_query_var( 'paged' );
  46. elseif ( get_query_var( 'page' ) ) :
  47. $paged = get_query_var( 'page' );
  48. else :
  49. $paged = 1;
  50. endif;
  51. $posts_per_page = get_option( 'jetpack_portfolio_posts_per_page', '10' );
  52. $args = array(
  53. 'post_type' => 'jetpack-portfolio',
  54. 'posts_per_page' => $posts_per_page,
  55. 'paged' => $paged,
  56. );
  57. $project_query = new WP_Query( $args );
  58. if ( post_type_exists( 'jetpack-portfolio' ) && $project_query->have_posts() ) :
  59. ?>
  60. <div class="portfolio-wrapper">
  61. <?php /* Start the Loop */ ?>
  62. <?php
  63. while ( $project_query->have_posts() ) :
  64. $project_query->the_post();
  65. ?>
  66. <?php get_template_part( 'content', 'portfolio' ); ?>
  67. <?php endwhile; ?>
  68. </div><!-- .portfolio-wrapper -->
  69. <?php
  70. illustratr_paging_nav( $project_query->max_num_pages );
  71. wp_reset_postdata();
  72. ?>
  73. <?php else : ?>
  74. <section class="no-results not-found">
  75. <header class="page-header">
  76. <h1 class="page-title"><?php _e( 'Nothing Found', 'illustratr' ); ?></h1>
  77. </header><!-- .page-header -->
  78. <div class="page-content">
  79. <?php if ( current_user_can( 'publish_posts' ) ) : ?>
  80. <p><?php printf( __( 'Ready to publish your first project? <a href="%1$s">Get started here</a>.', 'illustratr' ), esc_url( admin_url( 'post-new.php?post_type=jetpack-portfolio' ) ) ); ?></p>
  81. <?php else : ?>
  82. <p><?php _e( 'It seems we can&rsquo;t find what you&rsquo;re looking for. Perhaps searching can help.', 'illustratr' ); ?></p>
  83. <?php get_search_form(); ?>
  84. <?php endif; ?>
  85. </div><!-- .page-content -->
  86. </section><!-- .no-results -->
  87. <?php endif; ?>
  88. <?php endif; // end post_password_required() ?>
  89. </main><!-- #main -->
  90. </div><!-- #primary -->
  91. <?php get_sidebar(); ?>
  92. <?php get_footer(); ?>