archive.php 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. <?php
  2. /**
  3. * The template for displaying archive pages.
  4. *
  5. * @link https://codex.wordpress.org/Template_Hierarchy
  6. *
  7. * @package Optics-mws
  8. */
  9. #!-- ---------------------------------------------- for infinite-scroll --- --
  10. add_filter('next_posts_link_attributes', 'next_posts_link_attributes');
  11. function next_posts_link_attributes() {
  12. return 'class="next pagination__next" style="float:right"';
  13. }
  14. get_header();
  15. ?>
  16. <article id="comments-page" class="comments-page page type-page status-publish hentry entry">
  17. <header class="entry-header alignwide">
  18. <?php
  19. the_archive_title( '<h1 class="page-title">', '</h1>' );
  20. the_archive_description( '<div class="taxonomy-description">', '</div>' );
  21. ?>
  22. </header><!-- .page-header -->
  23. <div class="entry-content archive-wider">
  24. <ul class="blocks-gallery-grid">
  25. <?php while ( have_posts() ) : ?>
  26. <?php
  27. /* get_template_part( 'template-parts/content', get_post_format() ); */
  28. $post = get_post(the_post());
  29. echo "<!-- post->ID: $post->ID -->\n";
  30. $image = false;
  31. if ( get_attached_media('image', $post->ID) ) {
  32. $image = array_shift(get_attached_media('image', $post->ID));
  33. $image = $image->ID;
  34. echo "<!-- image->ID: $image -->\n";
  35. $imgs = get_attached_media('image', $post->ID);
  36. foreach($imgs as $img)
  37. echo "<!-- // img->ID: $img->ID -->\n";
  38. }
  39. if (! $image) {
  40. $image = get_post_thumbnail_id($post->ID);
  41. echo "<!-- get_the_post_thumbnail " . $image . " -->\n";
  42. }
  43. if ( $image ) {
  44. /* $thumbsrc = wp_get_attachment_image_src($image->ID, 'optics-mws-gallery-thumb')[0]; */
  45. $thumbsrc = wp_get_attachment_image_src($image, 'thumbnail')[0];
  46. $fullsrc = wp_get_attachment_image_src($image,'full')[0];
  47. $style = "";
  48. echo "<!-- thumbsrc: $thumbsrc // fullsrc: $fullsrc -->\n";
  49. } else {
  50. $thumbsrc = get_stylesheet_uri() . '/../270.png';
  51. $tithumbsrc = get_stylesheet_uri() . '/../560.png';
  52. echo "<!-- thumbsrc: $thumbsrc // tithumbsrc: $tithumbsrc -->\n";
  53. $style = "style='display: inline-block !important; background: #ddd;'";
  54. }
  55. /* echo "<li class='blocks-gallery-item'><figure><a href='$fullsrc'><img src='$thumbsrc' /></a>\n"; */
  56. echo "<li class='archive-slide'><figure><a href='$fullsrc'><img src='$thumbsrc' class='archive-slide-slide'/></a>\n";
  57. echo "<div class='archive-slide-titlebar' $style><a href='", get_permalink($post->ID),
  58. "' title='", get_the_date('', $post->ID), "'><span>", get_the_title($post->ID), "<br />(",
  59. get_the_date('', $post->ID), ")</span></a></div>";
  60. echo '</figure></li>';
  61. ?>
  62. <?php endwhile; ?>
  63. </ul>
  64. <?php the_posts_pagination(); ?>
  65. </div>
  66. </article>
  67. <?php
  68. get_footer();
  69. ?>