Advertisement
Mary_Pieroszkiewicz

single-przepisy.php

Oct 15th, 2019
198
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 7.87 KB | None | 0 0
  1. <?php get_header(); ?>
  2.  
  3. <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
  4.     <?php
  5.     while ( have_posts() ) :
  6.     the_post();
  7.  
  8.     global $wp_query;
  9.     $postid = $wp_query->post->ID;
  10.     ?>
  11.  
  12.     <div class="jku-label-wrapper">
  13.         <div><span>Przepis</span></div>
  14.     </div>
  15.  
  16.     <div class="jku-container">
  17.         <div class="jku-column jku-col-6">
  18.             <div class="jku-col-content">
  19.                 <div class="jku-recipe-top">
  20.                     <?php
  21.                     $video = get_post_meta($postid, 'link_do_filmu', true);
  22.  
  23.                     if ( !empty( $video ) ) {
  24.                         echo '<iframe width="560" height="315" src="' . $video . '" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe>';
  25.                     } elseif ( has_post_thumbnail() ) {
  26.                             echo '<img class="jku-recipe-featured-image" src="' . get_the_post_thumbnail_url($postid, 'full') . '" />';
  27.                     } else {
  28.                         echo '<img class="jku-recipe-featured-image" src="/wp-content/uploads/2019/09/jkuron-placeholder-image00.jpg" />';
  29.                     }
  30.                     ?>
  31.  
  32.                     <h5 class="jku-post-grid-categories">
  33.                         <?php
  34.                             $term_list = wp_get_post_terms($postid, 'kategorie-przepisow', array("fields" => "all"));
  35.                             foreach($term_list as $term_single) {
  36.                                 echo '<span><a href="' . esc_url(get_term_link( $term_single )) . '">' . $term_single->name . '</a></span>';
  37.                             }
  38.                         ?>
  39.                     </h5>
  40.  
  41.                     <?php
  42.                     the_title( '<h1>', '</h1>' );
  43.                     ?>
  44.                 </div>
  45.             </div>
  46.         </div>
  47.         <div class="jku-column jku-col-6">
  48.             <div class="jku-col-content">
  49.             </div>
  50.         </div>
  51.     </div>
  52.  
  53.     <div class="jku-container">
  54.         <div class="jku-column jku-col-9">
  55.             <div class="jku-col-content">
  56.                 <div class="jku-post-content-wrapper">
  57.                     <?php
  58.                     if ( !empty( get_the_content() ) ) {
  59.                         the_content();
  60.                     } else {
  61.                         $skladniki = get_post_meta($postid, 'skladniki', true);
  62.                         $sposob = get_post_meta($postid, 'sposob_przyrzadzania', true);
  63.  
  64.                         if ( !empty( $skladniki ) && !empty( $sposob ) ) {
  65.                             echo '<h3>Składniki</h3>';
  66.                             echo $skladniki;
  67.  
  68.                             echo '<h3>Sposób przyrządzania</h3>';
  69.                             echo $sposob;
  70.                         }
  71.  
  72.                         wp_reset_query();
  73.                     }
  74.  
  75.                     the_post_navigation(
  76.                         array(
  77.                             'next_text' => '<span class="meta-nav" aria-hidden="true">Kolejny przepis</span>',
  78.                             'prev_text' => '<span class="meta-nav" aria-hidden="true">Poprzedni przepis</span>'
  79.                         )
  80.                     );
  81.                     ?>
  82.                 </div>
  83.  
  84.                 <?php
  85.                 $term_list = wp_get_post_terms($post->ID, 'tagi-przepisow', array("fields" => "all"));
  86.                 if ( !empty( $term_list ) ) { ?>
  87.                     <div class="jku-recipe-tags-wrapper">
  88.                         <h4>Tagi:</h4>
  89.                         <ul class="jku-categories-cloud-wrapper">
  90.                         <?php
  91.                             foreach($term_list as $term_single) {
  92.                                 echo '<li><a href="' . esc_url(get_term_link( $term_single )) . '">' . $term_single->name . '</a></li>';
  93.                             }
  94.                         ?>
  95.                         </ul>
  96.                     </div>
  97.                 <?php } ?>
  98.  
  99.                 <div class="jku-recipe-share-wrapper">
  100.                     <h4>Udostępnij!</h4>
  101.                     <?php
  102.                         echo do_shortcode( '[addtoany]' );
  103.                     ?>
  104.                 </div>
  105.  
  106.                 <?php
  107.                 // If comments are open or we have at least one comment, load up the comment template.
  108.                 if ( comments_open() || get_comments_number() ) {
  109.                     comments_template();
  110.                 }
  111.                 ?>
  112.             </div>
  113.         </div>
  114.  
  115.         <div class="jku-column jku-col-3">
  116.             <div class="jku-col-content">
  117.                 <div class="google__adsense">
  118.                     <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
  119.                                 <ins class="adsbygoogle"
  120.                                             style="display:block"
  121.                                             data-ad-client="ca-pub-6608365990982293"
  122.                                             data-ad-slot="9478179590"
  123.                                             data-ad-format="auto"></ins>
  124.                                         <script>
  125.                                         (adsbygoogle = window.adsbygoogle || []).push({});
  126.                                     </script>
  127.                 </div>
  128.             </div>
  129.             </div>
  130.         </div>
  131.  
  132.         <?php
  133.         endwhile;
  134.         ?>
  135.     </div>
  136. </article>
  137.  
  138. <section class="jku-post-grid-wrapper jku-similar-posts-wrapper">
  139.     <div class="jku-label-wrapper">
  140.         <div><span>Sprawdź również</span></div>
  141.     </div>
  142.     <div class="jku-container">
  143.         <div class="jku-column jku-col-12">
  144.             <div class="jku-col-content">
  145.             <?php
  146.                 $args = array(
  147.                     'post_type'      => 'przepisy',
  148.                     'orderby'        => 'rand',
  149.                     'posts_per_page' => '4',
  150.                     'meta_query'     => array(
  151.                         array(
  152.                          'key'       => '_thumbnail_id',
  153.                          'compare'   => 'EXISTS'
  154.                         )
  155.                     )
  156.                 );
  157.  
  158.                 $testimonials = new WP_Query($args);
  159.                 ?>
  160.  
  161.                 <div class="jku-post-grid-items-wrapper">
  162.  
  163.                 <?php
  164.                 while ($testimonials->have_posts()) : $testimonials->the_post();
  165.                 // The post
  166.                 ?>
  167.  
  168.                     <div class="jku-post-grid-item">
  169.                         <?php if ( has_post_thumbnail() ) { ?>
  170.                             <a class="jku-post-grid-image" href="<?php the_permalink(); ?>">
  171.                             <?php the_post_thumbnail(); ?>
  172.  
  173.                         <?php } else { ?>
  174.                             <a class="jku-image-placeholder" href="<?php the_permalink(); ?>">
  175.  
  176.                         <?php }
  177.                         if ( has_term( 'wideo', 'kategorie-przepisow' ) ) {
  178.                             echo '<img class="jku-video-post-icon" src="/wp-content/themes/jakub-kuron/svg/jkuron-icon-video0.svg" /></img>';
  179.                         }
  180.                         echo '</a>';
  181.                         ?>
  182.  
  183.                         <h5 class="jku-post-grid-categories">
  184.                             <?php
  185.                                 $term_list = wp_get_post_terms($post->ID, 'kategorie-przepisow', array("fields" => "all"));
  186.                                 foreach($term_list as $term_single) {
  187.                                     echo '<span><a href="' . esc_url(get_term_link( $term_single )) . '">' . $term_single->name . '</a></span>';
  188.                                 }
  189.                             ?>
  190.                         </h5>
  191.                         <a class="jku-post-grid-title" href="<?php the_permalink(); ?>"><h3><?php echo get_the_title(); ?></h3></a>
  192.                     </div>
  193.  
  194.                 <?php
  195.                 endwhile;
  196.                 ?>
  197.  
  198.                 </div>
  199.  
  200.                 <?php
  201.                 wp_reset_postdata();
  202.             ?>
  203.             </div>
  204.         </div>
  205.     </div>
  206. </section>
  207.  
  208. <?php get_footer();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement