page-projects.php 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  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><?php the_title(); ?></h1>
  10. </div>
  11. <div class="projects-card">
  12. <div class="row">
  13. <?php $i = 0; $query = new WP_Query( array( 'category_name' => 'studio', 'posts_per_page' => -1 ) ); while ( $query->have_posts() ) : $query->the_post(); ?>
  14. <div class="col-lg-3">
  15. <div class="studio-thumbnail">
  16. <?php
  17. if ( has_post_thumbnail() ) {
  18. $img_url = wp_get_attachment_image_src( get_post_thumbnail_id(), 'studio' );
  19. } else {
  20. $img_url = get_post_meta( get_the_ID(), 'featured_image_url' );
  21. }
  22. ?>
  23. <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>
  24. </div>
  25. <article class="studio">
  26. <div class="entry-content">
  27. <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>
  28. <?php dw_good_excerpt( 110 ); ?>
  29. </div>
  30. </article>
  31. </div>
  32. <?php if ( ( ++$i % 4 ) == 0 ) : ?>
  33. </div>
  34. <div class="row">
  35. <?php endif; ?>
  36. <?php endwhile; wp_reset_postdata(); $i++; ?>
  37. </div>
  38. </div>
  39. </div>
  40. <?php get_footer('full'); ?>