catalog.php 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. <?php
  2. /*
  3. * Template Name: Каталог
  4. * */
  5. get_header();
  6. ?>
  7. <h1 class = "header-title">Магазин готовых шаблонов</h1>
  8. </div>
  9. </header>
  10. <main>
  11. <div class = "wrapper wrapper-flex-catalog">
  12. <aside>
  13. <form class="form-sidebar" method = "POST">
  14. <fieldset class = "value">
  15. <legend>Стоимость:</legend>
  16. <div class = "range-div">
  17. <input class = "range" name = "cost" type = "range" min = "0" max = "15000" id = "range" value = "8700" step = "1" oninput="change()"><br> <!--TO DO привязать к полям max min-->
  18. </div>
  19. <div class = "cost-label">
  20. <label class = "first-label">
  21. <input type = "number" name = "min-value-range" id = "min-range" value = "0">
  22. <span>ОТ:</span>
  23. </label>
  24. <label class = "second-label">
  25. <input type = "number" name = "max-value-range" id = "max-range" max = "15000" value = "8700" oninput="changeMax()">
  26. <span>ДО:</span>
  27. </label>
  28. </div>
  29. </fieldset>
  30. <fieldset>
  31. <legend class = "title-grid">Сетка:</legend>
  32. <label class = "radio">
  33. <input class = "radio" type = "radio" name = "grid" value = "adaptive" checked>
  34. <span class = "radio__text">Адаптивная</span>
  35. </label>
  36. <label class = "radio">
  37. <input class = "radio" type = "radio" name = "grid" value = "fixed">
  38. <span class = "radio__text">Фиксированная</span>
  39. </label>
  40. <label class = "radio">
  41. <input class = "radio" type = "radio" name = "grid" value = "flex" disabled>
  42. <span class = "radio__text">Резиновая</span>
  43. </label>
  44. </fieldset>
  45. <fieldset>
  46. <legend>Особенности:</legend>
  47. <label class = "checkbox">
  48. <input class = "checkbox" type = "checkbox" name = "feature" value = "slider">
  49. <span class="checkbox__text">Слайдер<br></span>
  50. </label>
  51. <label class = "checkbox">
  52. <input class = "checkbox" type = "checkbox" name = "feature" value = "block-of-features">
  53. <span class="checkbox__text">Блок преимуществ<br></span>
  54. </label>
  55. <label class = "checkbox">
  56. <input class = "checkbox" type = "checkbox" name = "feature" value = "news">
  57. <span class="checkbox__text">Новости<br></span>
  58. </label>
  59. <label class = "checkbox">
  60. <input class = "checkbox" type = "checkbox" name = "feature" value = "gallery">
  61. <span class="checkbox__text">Галерея<br></span>
  62. </label>
  63. <label class = "checkbox">
  64. <input class = "checkbox" type = "checkbox" name = "feature" value = "basket" disabled>
  65. <span class="checkbox__text">Корзина<br></span>
  66. </label>
  67. </fieldset>
  68. <input class = "button form-button" type = "submit" value = "Показать">
  69. </form>
  70. </aside>
  71. <div class="wrapper-flex-template-catalog">
  72. <div class = "flex-template">
  73. <section class = "ready-template">
  74. <h1 class = "visually-hidden">Готовые шаблоны</h1>
  75. <div class = "sorting">
  76. <h2>Сортировать:</h2>
  77. <ul class = "sorting-by">
  78. <li class = "sorting-by-elements active-sort"><a>По цене</a></li>
  79. <li class = "sorting-by-elements"><a href = "#">По типу</a></li>
  80. <li class = "sorting-by-elements"><a href = "#">По названию</a></li>
  81. <li><a class = "sort-down active-sort-order"></a></li>
  82. <li><a class = "sort-up" href = "#"></a></li>
  83. </ul>
  84. </div>
  85. <div class = "template">
  86. <ul class = "template-list">
  87. <?php
  88. $current_page = get_query_var('paged') ? get_query_var('paged') : 1;
  89. $posts = new WP_Query([
  90. 'post_type' => 'catalog',
  91. 'posts_per_page' => 4,
  92. 'paged' => $current_page,
  93. 'suppress_filters' => true,
  94. ]);
  95. if($posts->have_posts()) : while($posts->have_posts()): $posts->the_post();
  96. ?>
  97. <li class="template-item">
  98. <span class = "buttons-template">
  99. <i></i>
  100. </span>
  101. <?php
  102. the_post_thumbnail();
  103. ?>
  104. <div class = "template-describe">
  105. <div class = "template-discribe-wrapper">
  106. <h3>
  107. <?php the_title(); ?>
  108. </h3>
  109. <span> <?php the_excerpt(); ?> </span>
  110. <a class = "button button-red button-buy-template"
  111. href="<?php the_permalink(); ?>"
  112. >
  113. Посмотреть
  114. </a>
  115. </div>
  116. </div>
  117. </li>
  118. <?php
  119. endwhile;
  120. endif;
  121. // Сброс данных до нормального состояния
  122. wp_reset_postdata();
  123. echo "<div class='breadcrumbs'>" . paginate_links(array(
  124. 'total' => $posts->max_num_pages,
  125. 'current' => max( 1, get_query_var( 'paged' ) ),
  126. 'prev_next' => false,
  127. 'type' => 'list'
  128. )) . "</div>";
  129. ?>
  130. </ul>
  131. </div>
  132. </section>
  133. </div>
  134. </div>
  135. </div>
  136. </main>
  137. <?php
  138. get_footer();
  139. ?>