page-projects.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. /*
  3. * Template for the Studio → Projects child page (/studio/projects).
  4. * Lists every post in the `studio` category (moved off page-studio.php).
  5. */
  6. get_header(); ?>
  7. <div class="container leader">
  8. <div class="row mt-5">
  9. <h1><em><?php the_title(); ?></em></h1>
  10. </div>
  11. <div class="row">
  12. <?php $i = 0; $query = new WP_Query( array( 'category_name' => 'studio', 'posts_per_page' => -1 ) ); while ( $query->have_posts() ) : $query->the_post(); ?>
  13. <div class="col-lg-3">
  14. <div class="studio-thumbnail">
  15. <?php
  16. if ( has_post_thumbnail() ) {
  17. $img_url = wp_get_attachment_image_src( get_post_thumbnail_id(), 'studio' );
  18. } else {
  19. $img_url = get_post_meta( get_the_ID(), 'featured_image_url' );
  20. }
  21. ?>
  22. <a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( '%s', 'daw' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><img class="studio-thumb" src="<?php echo esc_url( $img_url[0] ?? '' ); ?>" width="100%" alt="<?php the_title(); ?>"/></a>
  23. </div>
  24. <article class="studio">
  25. <div class="entry-content">
  26. <h5><a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( '%s', 'daw' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></a></h5>
  27. <?php dw_good_excerpt( 110 ); ?>
  28. </div>
  29. </article>
  30. </div>
  31. <?php if ( ( ++$i % 4 ) == 0 ) : ?>
  32. </div>
  33. <div class="row">
  34. <?php endif; ?>
  35. <?php endwhile; wp_reset_postdata(); $i++; ?>
  36. </div>
  37. </div>
  38. <?php get_footer( 'home' ); ?>