portfolio-page.php 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  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 ( ! get_theme_mod( 'illustratr_hide_portfolio_page_content' ) ) : ?>
  11. <?php while ( have_posts() ) : the_post(); ?>
  12. <?php if ( '' != get_the_post_thumbnail() ) : ?>
  13. <div class="entry-thumbnail">
  14. <?php the_post_thumbnail( 'illustratr-featured-image' ); ?>
  15. </div><!-- .entry-thumbnail -->
  16. <?php endif; ?>
  17. <?php the_title( '<header class="page-header"><h1 class="page-title">', '</h1></header>' ); ?>
  18. <div class="page-content">
  19. <?php
  20. the_content();
  21. wp_link_pages( array(
  22. 'before' => '<div class="page-links"><span class="page-links-title">' . __( 'Pages:', 'illustratr' ) . '</span>',
  23. 'after' => '</div>',
  24. 'link_before' => '<span>',
  25. 'link_after' => '</span>',
  26. ) );
  27. ?>
  28. </div><!-- .page-content -->
  29. <?php edit_post_link( __( 'Edit', 'illustratr' ), '<div class="entry-meta"><span class="edit-link">', '</span></div>' ); ?>
  30. <?php endwhile; // end of the loop. ?>
  31. <?php endif; ?>
  32. <?php
  33. if ( get_query_var( 'paged' ) ) :
  34. $paged = get_query_var( 'paged' );
  35. elseif ( get_query_var( 'page' ) ) :
  36. $paged = get_query_var( 'page' );
  37. else :
  38. $paged = 1;
  39. endif;
  40. $posts_per_page = get_option( 'jetpack_portfolio_posts_per_page', '10' );
  41. $args = array(
  42. 'post_type' => 'jetpack-portfolio',
  43. 'posts_per_page' => $posts_per_page,
  44. 'paged' => $paged,
  45. );
  46. $project_query = new WP_Query ( $args );
  47. if ( post_type_exists( 'jetpack-portfolio' ) && $project_query -> have_posts() ) :
  48. ?>
  49. <div class="portfolio-wrapper">
  50. <?php /* Start the Loop */ ?>
  51. <?php while ( $project_query -> have_posts() ) : $project_query -> the_post(); ?>
  52. <?php get_template_part( 'content', 'portfolio' ); ?>
  53. <?php endwhile; ?>
  54. </div><!-- .portfolio-wrapper -->
  55. <?php
  56. illustratr_paging_nav( $project_query->max_num_pages );
  57. wp_reset_postdata();
  58. ?>
  59. <?php else : ?>
  60. <section class="no-results not-found">
  61. <header class="page-header">
  62. <h1 class="page-title"><?php _e( 'Nothing Found', 'illustratr' ); ?></h1>
  63. </header><!-- .page-header -->
  64. <div class="page-content">
  65. <?php if ( current_user_can( 'publish_posts' ) ) : ?>
  66. <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>
  67. <?php else : ?>
  68. <p><?php _e( 'It seems we can&rsquo;t find what you&rsquo;re looking for. Perhaps searching can help.', 'illustratr' ); ?></p>
  69. <?php get_search_form(); ?>
  70. <?php endif; ?>
  71. </div><!-- .page-content -->
  72. </section><!-- .no-results -->
  73. <?php endif; ?>
  74. </main><!-- #main -->
  75. </div><!-- #primary -->
  76. <?php get_sidebar(); ?>
  77. <?php get_footer(); ?>