Mary_Pieroszkiewicz

przepisy.php

Sep 26th, 2019
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.60 KB | None | 0 0
  1. <?php
  2. /**
  3.  * Template Name: Przepisy
  4.  * The template for displaying archive pages
  5.  *
  6.  * @link https://developer.wordpress.org/themes/basics/template-hierarchy/
  7.  *
  8.  * @package WordPress
  9.  * @subpackage Twenty_Nineteen
  10.  * @since 1.0.0
  11.  */
  12. get_header();
  13. ?>
  14.  
  15. <section class="jku-title-wrapper">
  16.     <div class="jku-container">
  17.         <div class="jku-column jku-col-12">
  18.             <div class="jku-col-content">
  19.                 <h1>Przepisy kulinarne</h1>
  20.             </div>
  21.         </div>
  22.     </div>
  23. </section>
  24.  
  25. <section class="jku-post-grid-wrapper">
  26.     <div class="jku-label-wrapper">
  27.         <div><span>Przepisy kulinarne</span></div>
  28.     </div>
  29.     <div class="jku-container">
  30.         <div class="jku-column jku-col-3">
  31.             <div class="jku-col-content">
  32.                 <h2>Kategorie</h2>
  33.                 <?php echo do_shortcode( '[cpt-categories-cloud]' ); ?>
  34.             </div>
  35.         </div>
  36.         <div class="jku-column jku-col-9">
  37.             <div class="jku-col-content">
  38.                 <?php
  39.                     $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
  40.  
  41.                     $wp_query = new WP_Query( array( 'post_type' => 'przepisy', 'ignore_sticky_posts' => 1, 'posts_per_page' => 12, 'paged' => $paged ) );
  42.  
  43.                     if ( $wp_query->have_posts() ) : ?>
  44.                         <div class="jku-post-grid-items-wrapper">
  45.  
  46.                             <?php
  47.                             // The post
  48.                             while ( $wp_query->have_posts() ) : $wp_query->the_post(); ?>
  49.                                 <div class="jku-post-grid-item">
  50.                                     <?php if ( has_post_thumbnail() ) { ?>
  51.                                         <a class="jku-post-grid-image" href="<?php the_permalink(); ?>">
  52.                                         <?php the_post_thumbnail(); ?>
  53.  
  54.                                     <?php } else { ?>
  55.                                         <a class="jku-image-placeholder" href="<?php the_permalink(); ?>">
  56.  
  57.                                     <?php }
  58.                                     if ( has_term( 'wideo', 'kategorie-przepisow' ) ) {
  59.                                         echo '<img class="jku-video-post-icon" src="/wp-content/themes/jakub-kuron/svg/jkuron-icon-video0.svg" /></img>';
  60.                                     }
  61.                                     echo '</a>';
  62.                                     ?>
  63.  
  64.                                     <h5 class="jku-post-grid-categories">
  65.                                         <?php
  66.                                             $term_list = wp_get_post_terms($post->ID, 'kategorie-przepisow', array("fields" => "all"));
  67.                                             foreach($term_list as $term_single) {
  68.                                                 echo '<span><a href="' . esc_url(get_term_link( $term_single )) . '">' . $term_single->name . '</a></span>';
  69.                                             }
  70.                                         ?>
  71.                                     </h5>
  72.                                     <a class="jku-post-grid-title" href="<?php the_permalink(); ?>"><h3><?php echo get_the_title(); ?></h3></a>
  73.                                 </div>
  74.                             <?php endwhile;
  75.                         ?>
  76.                         </div>
  77.  
  78.                         <?php
  79.                         twentynineteen_the_posts_navigation();
  80.  
  81.                     endif;
  82.  
  83.                     wp_reset_postdata();
  84.                 ?>
  85.             </div>
  86.         </div>
  87.     </div>
  88. </section>
  89.  
  90. <?php get_footer();
Advertisement
Add Comment
Please, Sign In to add comment