Advertisement
Guest User

Untitled

a guest
Mar 20th, 2019
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.87 KB | None | 0 0
  1. <?php get_header(); ?>
  2.  
  3. <?php
  4. $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
  5. $args = array(
  6. 'post_type' => 'post',
  7. 'posts_per_page' => 2,
  8. 'orderby' => 'menu_order',
  9. 'order' => 'ASC',
  10. 'paged' => $paged
  11. );
  12. global $post;
  13. $the_query = new WP_Query($args);
  14. if ($the_query->have_posts()) {
  15. ?>
  16. <div class="container">
  17. <div class="row">
  18. <?php
  19. while ($the_query->have_posts()) {
  20. $the_query->the_post();
  21. $alt = get_post_meta($post->ID,'_wp_attachment_image_alt', true);
  22. $thumb = get_the_post_thumbnail_url($post->ID, 'medium');
  23. ?>
  24. <div class="col-4">
  25. <img src="<?php echo $thumb; ?>" alt="<?php echo $alt; ?>">
  26. <h2><?php the_title(); ?></h2>
  27. <?php the_content(); ?>
  28. <p><?php echo wp_trim_words(get_the_content(), 4, '...' ); ?></p>
  29. <p><?php the_time('j F Y, H:i'); ?></p>
  30. <a href="<?php echo get_permalink( $post->ID ); ?>">Więcej</a>
  31. </div>
  32. <?php } ?>
  33.  
  34. <div class="col-12">
  35. <?php the_posts_pagination(array(
  36. 'mid_size' => 2,
  37. 'prev_text' => 'Previous',
  38. 'next_text' => 'Next',
  39. )); ?>
  40. </div>
  41. </div>
  42. </div>
  43.  
  44. <?php wp_reset_postdata(); } ?>
  45.  
  46. <form role="search" method="get" action="<?php echo home_url( '/' ); ?>">
  47. <label for="s">Search for:</label>
  48. <input type="text" value="" name="s" id="s" placeholder="<?php the_search_query(); ?>" />
  49. <input type="submit" value="Search" />
  50. </form>
  51.  
  52. <?php get_footer(); ?>
  53.  
  54. <?php get_header(); ?>
  55.  
  56. <div class="container">
  57. <div class="row">
  58. <div class="col-12">
  59. <?php if (have_posts()) {
  60. while (have_posts()) { the_post();
  61. $thumb_id = get_post_thumbnail_id($post->ID);
  62. $alt = get_post_meta($thumb_id,'_wp_attachment_image_alt', true);
  63. $thumb = get_the_post_thumbnail_url($post->ID, 'medium');
  64. ?>
  65. <img src="<?php echo $thumb; ?>" alt="<?php echo $alt; ?>">
  66. <h2><?php the_title(); ?></h2>
  67. <?php the_content(); ?>
  68. <p><?php the_time('j F Y, H:i'); ?></p>
  69. <a href="<?php echo get_author_posts_url(get_the_author_meta('ID')); ?>"><?php the_author(); ?></a>
  70. <?php $categories = get_the_category();
  71. $separator = ", ";
  72. $output = '';
  73. if ($categories) {
  74. foreach ($categories as $category) {
  75. $output .= '<a href="'.get_category_link($category->term_id).'">'.$category->cat_name.'</a>'.$separator;
  76. }
  77. echo trim($output, $separator);
  78. } ?>
  79. <?php $tags = get_the_tags();
  80. $separator = ", ";
  81. $output = '';
  82. if ($tags) {
  83. foreach ($tags as $tag) {
  84. $output .= '<a href="'.get_tag_link($tag->term_id).'">'.$tag->name.'</a>'.$separator;
  85. }
  86. echo trim($output, $separator);
  87. } ?>
  88. <?php }
  89. } ?>
  90. </div>
  91. </div>
  92. </div>
  93.  
  94. <?php get_footer(); ?>
  95.  
  96. <?php get_header(); ?>
  97.  
  98. <h2>
  99. <?php if (is_category()) {
  100. single_cat_title();
  101. } elseif ( is_tag() ) {
  102. single_tag_title();
  103. } elseif ( is_author() ) {
  104. the_post();
  105. echo 'Author Archives: ' . get_the_author();
  106. rewind_posts();
  107. } elseif ( is_day() ) {
  108. echo 'Daily Archives: ' . get_the_date();
  109. } elseif ( is_month() ) {
  110. echo 'Monthly Archives: ' . get_the_date('F Y');
  111. } elseif ( is_year() ) {
  112. echo 'Yearly Archives: ' . get_the_date('Y');
  113. } else {
  114. echo 'Archives:';
  115. } ?>
  116. </h2>
  117.  
  118. <?php
  119. $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
  120. $args = array(
  121. 'post_type' => 'post',
  122. 'posts_per_page' => 2,
  123. 'orderby' => 'menu_order',
  124. 'order' => 'ASC',
  125. 'paged' => $paged
  126. );
  127. global $post;
  128. $the_query = new WP_Query($args);
  129. if ($the_query->have_posts()) {
  130. ?>
  131. <div class="container">
  132. <div class="row">
  133. <?php
  134. while ($the_query->have_posts()) {
  135. $the_query->the_post();
  136. $alt = get_post_meta($post->ID,'_wp_attachment_image_alt', true);
  137. $thumb = get_the_post_thumbnail_url($post->ID, 'medium');
  138. ?>
  139. <div class="col-4">
  140. <img src="<?php echo $thumb; ?>" alt="<?php echo $alt; ?>">
  141. <h2><?php the_title(); ?></h2>
  142. <?php the_content(); ?>
  143. <p><?php echo wp_trim_words(get_the_content(), 4, '...' ); ?></p>
  144. <p><?php the_time('j F Y, H:i'); ?></p>
  145. <a href="<?php echo get_permalink( $post->ID ); ?>">Więcej</a>
  146. </div>
  147. <?php } ?>
  148.  
  149. <div class="col-12">
  150. <?php the_posts_pagination(array(
  151. 'mid_size' => 2,
  152. 'prev_text' => 'Previous',
  153. 'next_text' => 'Next',
  154. )); ?>
  155. </div>
  156. </div>
  157. </div>
  158.  
  159. <?php wp_reset_postdata(); } ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement