Created
November 19, 2022 06:32
-
-
Save seojacky/e3e7e8e1b746766d20a5d02ca594969d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* The template for displaying all single posts | |
* | |
* @link https://developer.wordpress.org/themes/basics/template-hierarchy/#single-post | |
* | |
* @package Beezzly | |
*/ | |
get_header(); | |
$category = get_the_category(); | |
if (count($category) > 0) { | |
$category = end($category); | |
} | |
?> | |
<div class="main"> | |
<div class="container"> | |
<div class="breadcrumb"> | |
<ol itemscope itemtype="https://schema.org/BreadcrumbList" class="breadcrumbList"> | |
<li itemprop="itemListElement" itemscope itemtype="https://schema.org/ListItem"> | |
<a href="<?php echo home_url(); ?>" title="Home" itemprop="item"> | |
<span itemprop="name">Home</span> | |
</a> | |
<meta itemprop="position" content="0"> | |
</li> | |
<li itemprop="itemListElement" itemscope itemtype="https://schema.org/ListItem"> | |
<a href="<?php echo get_category_link($category->term_id); ?>" | |
title="<?php echo $category->cat_name; ?>" itemprop="item"> | |
<span itemprop="name"><?php echo $category->cat_name; ?></span> | |
</a> | |
<meta itemprop="position" content="1"> | |
</li> | |
<li itemprop="itemListElement" itemscope itemtype="https://schema.org/ListItem"> | |
<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>" itemprop="item"> | |
<span itemprop="name"><?php the_title(); ?></span> | |
</a> | |
<meta itemprop="position" content="2"> | |
</li> | |
</ol> | |
</div> | |
<div class="inner-news"> | |
<div class="row"> | |
<div class="right col-8"> | |
<h1><?php the_title(); ?></h1> | |
<?php | |
$subtitle = get_field('subtitle_single'); | |
?> | |
<h2 class="h2"><?php echo $subtitle; ?></h2> | |
<?php beezzly_posted_on(); ?> | |
<?php | |
//the_post_thumbnail('inner-main-img'); | |
//echo kama_thumb_img('w=787 &h=524'); | |
$attr = array('src' => get_the_post_thumbnail_url( null, 'full' ), 'style' => 'display: none;'); | |
the_post_thumbnail(array(785, 523), $attr); | |
?> | |
<div class="text"> | |
<?php the_content(); ?> | |
</div> | |
<?php | |
$post_id = get_queried_object_id(); | |
$user_id = get_post_field( 'post_author', $post_id ); | |
$user_role = get_the_author_meta( 'roles', $user_id); | |
if (in_array( 'author', $user_role)): | |
?> | |
<blockquote class="blockquote"> | |
<div class="title"><strong>Written by </strong> | |
<?php | |
the_author_posts_link(); // Почему сцуко это не работает? | |
the_author_meta('display_name', $user_id);?> | |
</div> | |
<div class="author-info"> | |
<div class="author-info-img"> | |
<?php | |
echo get_avatar($user_id, 103, 'mystery', 'avatar'); | |
?> | |
</div> | |
<div class="author-info__descr"><?php the_author_meta('description', $user_id); ?></div> | |
</div> | |
<!-- /.author-info --> | |
<footer class="blockquote-footer">Our editors independently research, test, and recommend | |
the best products; you can learn more about our <a | |
href="/review-process">review process here</a>. | |
</footer> | |
</blockquote> | |
<?php endif; ?> | |
<?php | |
// check if the flexible content field has rows of data | |
if (have_rows('type_single')) : | |
// loop through the rows of data | |
while (have_rows('type_single')) : the_row(); | |
if (get_row_layout() == 'piece') : ?> | |
<div class="shop-blues"> | |
<div class="row"> | |
<?php if (have_rows('piece_shop')) : | |
while (have_rows('piece_shop')) : the_row(); | |
$image = get_sub_field('img_piece'); | |
$description = get_sub_field('description_piece'); | |
$name = get_sub_field('shop_name_piece'); | |
$shop = get_sub_field('shop_link_piece'); | |
$price = get_sub_field('price_piece'); | |
$link = get_sub_field('link_piece'); | |
?> | |
<div class="item"> | |
<div class="img-wrap"><img | |
src="<?php | |
//echo $image['sizes']['shop_piece']; | |
echo kama_thumb_img('w=175 &h=175'); | |
?>" | |
alt="<?php echo $image['alt']; ?>" | |
title="<?php echo $image['title']; ?>"/></div> | |
<h4 class="title"><?php echo $description; ?></h4> | |
<footer> | |
<h5><?php echo $name; ?></h5> | |
<p><?php echo $shop; ?></p> | |
<span class="price">$<?php echo $price; ?></span> | |
<a href="<?php echo $link; ?>" class="btn">SHOP NOW</a> | |
</footer> | |
</div> | |
<?php endwhile; ?> | |
</div> | |
</div> | |
<?php endif; | |
elseif (get_row_layout() == 'shop') : ?> | |
<div class="more-links"> | |
<?php if (have_rows('link_shop')) : | |
while (have_rows('link_shop')) : the_row(); | |
$image = get_sub_field('img_link'); | |
$title = get_sub_field('title_link'); | |
$btn = get_sub_field('btn_link'); | |
$text = get_sub_field('text_link'); | |
$link = get_sub_field('link_link'); | |
?> | |
<div class="item"> | |
<div class="img-wrap"><img | |
src="<?php | |
//echo $image['sizes']['shop_link']; | |
echo kama_thumb_src('w=375 &h=375'); | |
?>" | |
alt="<?php echo $image['alt']; ?>" | |
title="<?php echo $image['title']; ?>"/></div> | |
<div class="description"> | |
<h4 class="title"><?php echo $title; ?></h4> | |
<?php if ($link != '') { ?><a href="<?php echo $link; ?>" | |
class="btn" | |
rel="nofollow"><?php echo $btn; ?></a><?php } ?> | |
<p><?php echo $text; ?></p> | |
</div> | |
</div> | |
<?php endwhile; ?> | |
</div> | |
<?php endif; | |
elseif (get_row_layout() == 'text') : ?> | |
<div class="text"> | |
<?php the_sub_field('single_text');; ?> | |
</div> | |
<?php | |
endif; | |
endwhile; | |
else : | |
// no layouts found | |
endif; | |
?> | |
<?= do_shortcode('[anycomment]') ?> | |
<?php if (have_rows('youtube')) : ?> | |
<?php while (have_rows('youtube')) : the_row(); | |
//$youtube_title = get_sub_field('youtube_title'); | |
//$youtube_link = get_sub_field('youtube_link'); | |
?> | |
<?php global $wp_embed; $youtube_link = get_sub_field('youtube_link'); echo $wp_embed->autoembed( $youtube_link ); ?> | |
<style>lite-youtube {max-width: 100% !important;}</style> | |
<?php endwhile; ?> | |
<?php endif; ?> | |
</div> | |
<div class="col-4 advertising-column"> | |
<? get_template_part('template-parts/advertising'); ?> | |
</div> | |
</div> | |
</div> | |
<!-- <div class="read-next"> | |
<div class="title">Read Next</div> | |
<div class="row"> | |
<?php $currentID = get_the_ID(); ?> | |
<?php | |
$items = 0; | |
$exept = []; | |
global $post; | |
$category = get_the_category($post->ID); | |
$category = $category[0]->cat_ID; | |
$myposts = get_posts(['numberposts' => 3, 'offset' => 0, 'category__in' => [$category], 'post_status' => 'publish', 'order' => 'ASC']); | |
foreach ($myposts as $post) : | |
setup_postdata($post); | |
if ($currentID != $post->ID) { | |
?> | |
<div class="col-6 item item-link"> | |
<a href="<?php the_permalink(); ?>" class="img-wrap"><?php the_post_thumbnail('read_next'); ?></a> | |
<div class="description"> | |
<a href="<?php the_permalink(); ?>" class="tittle read-next-item__title"> | |
<?php the_title(); ?> | |
</a> | |
</div> | |
</div> | |
<?php $items++; ?> | |
<?php $exept[] = $post->ID; ?> | |
<?php if ($items == 2) { | |
break; | |
} ?> | |
<?php } ?> | |
<?php endforeach; ?> | |
<?php wp_reset_query(); ?> | |
</div> | |
</div> --> | |
<div class="advertising-block"> | |
<!-- <div class="title"><span>Advertising - Continue Reading Below</span></div> --> | |
<!-- <a href="#" class="img-wrap"><img src="<?php echo get_template_directory_uri(); ?>/images/example/img_28.png" alt=""></a> --> | |
</div> | |
<?php | |
$posts = get_field('articles_single'); | |
if ($posts) : ?> | |
<div class="more-from more-from-tips"> | |
<div class="title more-from__title">MORE USEFUL TIPS</div> | |
<div class="row"> | |
<div class="col-8"> | |
<div class="row"> | |
<?php | |
foreach ($posts as $post) :?> | |
<?php setup_postdata($post); ?> | |
<?php $shortText = get_field('short_description_single'); ?> | |
<div class="col-4 item item-link"> | |
<a href="<?php the_permalink(); ?>" | |
class="img-wrap"><?php | |
//the_post_thumbnail('more_from'); | |
//echo kama_thumb_img('w=373 &h=173'); | |
the_post_thumbnail('medium'); | |
?></a> | |
<div class="description text-center"> | |
<a href="<?php the_permalink(); ?>" class="title"> | |
<?php the_title(); ?> | |
</a> | |
</div> | |
</div> | |
<?php endforeach; ?> | |
<?php wp_reset_query(); ?> | |
</div> | |
<!-- .row --> | |
</div> | |
<!-- .col-8 --> | |
<div class="col-4"> | |
<div class="sticky"> | |
<div class="advertising-aside"> | |
<!-- <div class="title-top text-center mt0">Advertising</div> --> | |
<!-- <a href="#" class="img-wrap"><img src="<?= get_template_directory_uri() ?>/images/example/img_27.jpg" alt=""></a> --> | |
</div> | |
</div> | |
</div> | |
<!-- .col-4 --> | |
</div> | |
<!-- .row --> | |
<?php endif; ?> | |
</div> | |
<!-- .container --> | |
</div> | |
</div> | |
<?php | |
get_footer(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment