wp_back/wp-content/themes/simple-theme/template-parts/single.php

368 lines
19 KiB
PHP
Raw Normal View History

2024-05-20 15:37:46 +03:00
<?php
if (!defined('ABSPATH')) {
exit; // Exit if accessed directly.
}
?>
<?php
while (have_posts()) : the_post();
$post_id = get_the_ID();
$comments_count = wp_count_comments($post_id);
$tax_id = get_the_tags(get_the_ID())[0]->term_id;
$show_fin_offer_widget = false;
$show_ipoteka_widget = false;
// проверяем на соответствие нужного тега, чтобы знать какой виджет выводить
switch ($tax_id) {
case 17:
$show_fin_offer_widget = true;
break;
case 30:
$show_fin_offer_widget = true;
break;
case 32:
$show_fin_offer_widget = true;
break;
case 9:
$show_fin_offer_widget = true;
break;
case 31:
$show_ipoteka_widget = true;
break;
case 28:
$show_ipoteka_widget = true;
break;
case 10:
$show_ipoteka_widget = true;
break;
}
?>
<?php $tags = get_the_tags(); $tag = $tags[0]->slug; $same_id = get_the_ID(); ?><span id="catcat" data-tag ="<?php echo $tag; ?>" data-sameid="<?php echo $same_id; ?>" ></span>
2024-06-09 15:36:55 +03:00
<main <?php post_class('site-main'); ?> role="main">
2024-05-20 15:37:46 +03:00
<div class="single-article-post" id="article.id">
<div class="projects-list-wrap"> <!-- begin of wrapper -->
<span class="data-wrapper" data-title="<?php the_title(); ?>" data-url="<?php the_permalink(); ?>" data-description="<?php echo get_post_meta(get_the_ID(), '_yoast_wpseo_metadesc', true); ; ?>">
<?php
?>
<!-- хлебные крошки -->
<p id="breadcrumbs" class="breadcrumbs-container">
<span><a href="https://pampadu.ru/">Pampadu</a></span>
<span class="breadcrump-separator"></span>
<span><span><a href="https://pampadu.ru/blog/">Блог</a></span>
<span class="breadcrump-separator"></span>
<span class="breadcrumb_last" aria-current="page"><?php the_title(); ?></span></span>
</p>
<div class="ppd-container article-container">
<div class="article-header">
<h1 class="article-title"><?php the_title(); ?></h1>
<div class="layout article-tags wrap">
<?php if (!empty(get_the_tags(get_the_ID()))) : ?>
<?php foreach (get_the_tags(get_the_ID()) as $tag) : ?>
<div class="article-tag">
<a class="article-tag__link <?= $tag->slug . '__tag'?>" href="<?=str_replace("\"", "", "https://pampadu.ru/blog");?>/tag/<?= $tag->slug ?>/">
#<?= $tag->name ?>
</a>
</div>
<?php endforeach; ?>
<?php endif; ?>
</div>
<div class="article-details">
<div class="article-details__common">
<?php echo get_avatar( get_the_author_meta('ID'), 50, '', '', array('class'=>'article-author__avatar')) ?>
<a class="article-author__name" href="<?php echo get_author_posts_url( $post->post_author ); ?>"><?php the_author(); ?></a>
<span class="article-details__separator">|</span>
<span class="article-date">Дата публикации: <?= get_the_date('d.m.Y') ?></span>
<span class="article-details__separator">|</span>
<?php echo do_shortcode('[rt_reading_time label="Время чтения:"]') ?>
</div>
<div class="article-details__social">
<?php
echo do_shortcode('[posts_like_dislike]');
echo do_shortcode('[epvc_views]');
echo '<div id="article-' . $post_id . '-comments__count" class="article-comments__count comments-count-' . $post_id . '" data-id="' . $post_id . '" >';
echo '<svg class="article-comments__icon" width="15" height="14" viewBox="0 0 15 14" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M13.125 8.75C13.125 9.05942 12.9933 9.35616 12.7589 9.57496C12.5245 9.79375 12.2065 9.91667 11.875 9.91667H4.375L1.875 12.25V2.91667C1.875 2.60725 2.0067 2.3105 2.24112 2.09171C2.47554 1.87292 2.79348 1.75 3.125 1.75H11.875C12.2065 1.75 12.5245 1.87292 12.7589 2.09171C12.9933 2.3105 13.125 2.60725 13.125 2.91667V8.75Z" stroke="#A4ABB6" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
</svg>';
echo '<span class="article-comments__num">';
echo $comments_count->approved;
echo '</span>';
echo '</div>';
?>
<div class="article-share">
<svg class="article-share__icon" width="15" height="15" viewBox="0 0 15 15" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M11.25 5C12.2855 5 13.125 4.16053 13.125 3.125C13.125 2.08947 12.2855 1.25 11.25 1.25C10.2145 1.25 9.375 2.08947 9.375 3.125C9.375 4.16053 10.2145 5 11.25 5Z" stroke="#7245FF" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M3.75 9.375C4.78553 9.375 5.625 8.53553 5.625 7.5C5.625 6.46447 4.78553 5.625 3.75 5.625C2.71447 5.625 1.875 6.46447 1.875 7.5C1.875 8.53553 2.71447 9.375 3.75 9.375Z" stroke="#7245FF" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M11.25 13.75C12.2855 13.75 13.125 12.9105 13.125 11.875C13.125 10.8395 12.2855 10 11.25 10C10.2145 10 9.375 10.8395 9.375 11.875C9.375 12.9105 10.2145 13.75 11.25 13.75Z" stroke="#7245FF" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M5.36914 8.44385L9.63789 10.9313" stroke="#7245FF" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M9.63164 4.06885L5.36914 6.55635" stroke="#7245FF" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
</svg>
<ul class="article-share__list links-container">
<li class="article-share__item">
<a href="https://t.me/joinchat/TZvpUlJfAZfdZjuf" target="_blank">
<svg width="28" height="28" viewBox="0 0 28 28" fill="none" xmlns="http://www.w3.org/2000/svg">
<path class="icon-main-color" d="M13 26C20.1797 26 26 20.1797 26 13C26 5.8203 20.1797 0 13 0C5.8203 0 0 5.8203 0 13C0 20.1797 5.8203 26 13 26Z" fill="#039BE5"/>
<path d="M5.94862 12.7181L18.4828 7.88532C19.0645 7.67515 19.5726 8.02724 19.3841 8.9069L19.3852 8.90582L17.251 18.9602C17.0929 19.6731 16.6693 19.8464 16.0767 19.5106L12.8267 17.1153L11.2591 18.6255C11.0858 18.7988 10.9395 18.9451 10.6037 18.9451L10.8345 15.6377L16.8578 10.1961C17.12 9.96532 16.7993 9.83532 16.4537 10.065L9.01012 14.7515L5.80129 13.7505C5.10471 13.5295 5.08954 13.0539 5.94862 12.7181Z" fill="white"/>
</svg>
</a>
</li>
<li class="article-share__item">
<a href="https://vk.com/avto_yslyga" target="_blank">
<svg width="28" height="28" fill="none" xmlns="http://www.w3.org/2000/svg"><circle class="icon-main-color" cx="13" cy="13" r="13" fill="#009BDD"/><path d="M6.85 9H5.1c-.5 0-.6.24-.6.5 0 .46.6 2.76 2.76 5.8 1.45 2.07 3.49 3.2 5.34 3.2 1.11 0 1.25-.25 1.25-.68v-1.57c0-.5.1-.6.46-.6.26 0 .7.13 1.74 1.13 1.19 1.2 1.38 1.72 2.05 1.72h1.75c.5 0 .75-.25.6-.74-.15-.5-.72-1.2-1.47-2.05-.4-.49-1.02-1-1.2-1.26-.26-.34-.2-.49 0-.78 0 0 2.13-3 2.35-4.03.11-.37 0-.64-.53-.64h-1.75a.76.76 0 00-.76.5s-.9 2.16-2.15 3.57c-.41.41-.6.54-.82.54-.1 0-.27-.13-.27-.5V9.64c0-.44-.13-.64-.5-.64H10.6c-.28 0-.45.2-.45.4 0 .42.64.52.7 1.7v2.58c0 .57-.1.67-.32.67-.6 0-2.04-2.18-2.9-4.67C7.47 9.2 7.3 9 6.85 9z" fill="#fff"/></svg>
</a>
</li>
<li class="article-share__item">
<a href="https://www.youtube.com/channel/UC0SeTdHMfY67ku8e7m-GMTw" target="_blank">
<svg width="28" height="28" viewBox="0 0 28 28" fill="none" xmlns="http://www.w3.org/2000/svg">
<path class="icon-main-color icon-youtube" d="M13 26C20.1797 26 26 20.1797 26 13C26 5.8203 20.1797 0 13 0C5.8203 0 0 5.8203 0 13C0 20.1797 5.8203 26 13 26Z" fill="#FF0000"/>
<g clip-path="url(#clip0)">
<path d="M20.1865 9.56153C20.014 8.94686 19.5058 8.46282 18.8604 8.29855C17.6907 8 13 8 13 8C13 8 8.30937 8 7.13959 8.29855C6.49423 8.46282 5.98593 8.94686 5.81344 9.56153C5.5 10.6756 5.5 13 5.5 13C5.5 13 5.5 15.3244 5.81344 16.4385C5.98593 17.0531 6.49423 17.5372 7.13959 17.7015C8.30937 18 13 18 13 18C13 18 17.6907 18 18.8604 17.7015C19.5058 17.5372 20.014 17.0531 20.1865 16.4385C20.5 15.3244 20.5 13 20.5 13C20.5 13 20.5 10.6756 20.1865 9.56153Z" fill="white"/>
<path class="icon-main-color icon-youtube" d="M11.4658 15.1104L15.3863 13.0001L11.4658 10.8896V15.1104Z" fill="#FF0000"/>
</g>
<defs>
<clipPath id="clip0">
<rect width="15" height="10" fill="white" transform="translate(5.5 8)"/>
</clipPath>
</defs>
</svg>
</a>
</li>
</ul>
</div>
</div>
</div>
</div>
<article class="article-body">
<?php
// echo wp_first_paragraph_excerpt(get_the_ID());
// echo get_the_post_thumbnail( get_the_ID() );
the_content();
// the_excerpt();
// echo '123';
// echo get_the_post_thumbnail( $post_id );
// echo get_the_content();
// $content = apply_filters( 'the_content', get_the_content() );
// echo $content;
?>
2024-06-09 15:36:55 +03:00
<div id="root" style="width: 100%;"></div>
2024-05-20 15:37:46 +03:00
<div class="article-details__social article-details__social-bottom">
<button class="show-commmentsform">Оставить комментарий</button>
<?php
echo do_shortcode('[posts_like_dislike]');
echo do_shortcode('[epvc_views]');
echo '<div id="article-' . $post_id . '-comments__count" class="article-comments__count comments-count-' . $post_id . '" data-id="' . $post_id . '" >';
echo '<svg class="article-comments__icon" width="15" height="14" viewBox="0 0 15 14" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M13.125 8.75C13.125 9.05942 12.9933 9.35616 12.7589 9.57496C12.5245 9.79375 12.2065 9.91667 11.875 9.91667H4.375L1.875 12.25V2.91667C1.875 2.60725 2.0067 2.3105 2.24112 2.09171C2.47554 1.87292 2.79348 1.75 3.125 1.75H11.875C12.2065 1.75 12.5245 1.87292 12.7589 2.09171C12.9933 2.3105 13.125 2.60725 13.125 2.91667V8.75Z" stroke="#A4ABB6" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
</svg>';
echo '<span class="article-comments__num">';
echo get_comments_number($post_id);
echo '</span>';
echo '</div>';
?>
<div class="article-share">
<svg class="article-share__icon" width="15" height="15" viewBox="0 0 15 15" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M11.25 5C12.2855 5 13.125 4.16053 13.125 3.125C13.125 2.08947 12.2855 1.25 11.25 1.25C10.2145 1.25 9.375 2.08947 9.375 3.125C9.375 4.16053 10.2145 5 11.25 5Z" stroke="#7245FF" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M3.75 9.375C4.78553 9.375 5.625 8.53553 5.625 7.5C5.625 6.46447 4.78553 5.625 3.75 5.625C2.71447 5.625 1.875 6.46447 1.875 7.5C1.875 8.53553 2.71447 9.375 3.75 9.375Z" stroke="#7245FF" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M11.25 13.75C12.2855 13.75 13.125 12.9105 13.125 11.875C13.125 10.8395 12.2855 10 11.25 10C10.2145 10 9.375 10.8395 9.375 11.875C9.375 12.9105 10.2145 13.75 11.25 13.75Z" stroke="#7245FF" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M5.36914 8.44385L9.63789 10.9313" stroke="#7245FF" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M9.63164 4.06885L5.36914 6.55635" stroke="#7245FF" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
</svg>
<ul class="article-share__list links-container">
<li class="article-share__item">
<a href="https://t.me/joinchat/TZvpUlJfAZfdZjuf" target="_blank">
<svg width="28" height="28" viewBox="0 0 28 28" fill="none" xmlns="http://www.w3.org/2000/svg">
<path class="icon-main-color" d="M13 26C20.1797 26 26 20.1797 26 13C26 5.8203 20.1797 0 13 0C5.8203 0 0 5.8203 0 13C0 20.1797 5.8203 26 13 26Z" fill="#039BE5"/>
<path d="M5.94862 12.7181L18.4828 7.88532C19.0645 7.67515 19.5726 8.02724 19.3841 8.9069L19.3852 8.90582L17.251 18.9602C17.0929 19.6731 16.6693 19.8464 16.0767 19.5106L12.8267 17.1153L11.2591 18.6255C11.0858 18.7988 10.9395 18.9451 10.6037 18.9451L10.8345 15.6377L16.8578 10.1961C17.12 9.96532 16.7993 9.83532 16.4537 10.065L9.01012 14.7515L5.80129 13.7505C5.10471 13.5295 5.08954 13.0539 5.94862 12.7181Z" fill="white"/>
</svg>
</a>
</li>
<li class="article-share__item">
<a href="https://vk.com/avto_yslyga" target="_blank">
<svg width="28" height="28" fill="none" xmlns="http://www.w3.org/2000/svg"><circle class="icon-main-color" cx="13" cy="13" r="13" fill="#009BDD"/><path d="M6.85 9H5.1c-.5 0-.6.24-.6.5 0 .46.6 2.76 2.76 5.8 1.45 2.07 3.49 3.2 5.34 3.2 1.11 0 1.25-.25 1.25-.68v-1.57c0-.5.1-.6.46-.6.26 0 .7.13 1.74 1.13 1.19 1.2 1.38 1.72 2.05 1.72h1.75c.5 0 .75-.25.6-.74-.15-.5-.72-1.2-1.47-2.05-.4-.49-1.02-1-1.2-1.26-.26-.34-.2-.49 0-.78 0 0 2.13-3 2.35-4.03.11-.37 0-.64-.53-.64h-1.75a.76.76 0 00-.76.5s-.9 2.16-2.15 3.57c-.41.41-.6.54-.82.54-.1 0-.27-.13-.27-.5V9.64c0-.44-.13-.64-.5-.64H10.6c-.28 0-.45.2-.45.4 0 .42.64.52.7 1.7v2.58c0 .57-.1.67-.32.67-.6 0-2.04-2.18-2.9-4.67C7.47 9.2 7.3 9 6.85 9z" fill="#fff"/></svg>
</a>
</li>
<li class="article-share__item">
<a href="https://www.youtube.com/channel/UC0SeTdHMfY67ku8e7m-GMTw" target="_blank">
<svg width="28" height="28" viewBox="0 0 28 28" fill="none" xmlns="http://www.w3.org/2000/svg">
<path class="icon-main-color icon-youtube" d="M13 26C20.1797 26 26 20.1797 26 13C26 5.8203 20.1797 0 13 0C5.8203 0 0 5.8203 0 13C0 20.1797 5.8203 26 13 26Z" fill="#FF0000"/>
<g clip-path="url(#clip0)">
<path d="M20.1865 9.56153C20.014 8.94686 19.5058 8.46282 18.8604 8.29855C17.6907 8 13 8 13 8C13 8 8.30937 8 7.13959 8.29855C6.49423 8.46282 5.98593 8.94686 5.81344 9.56153C5.5 10.6756 5.5 13 5.5 13C5.5 13 5.5 15.3244 5.81344 16.4385C5.98593 17.0531 6.49423 17.5372 7.13959 17.7015C8.30937 18 13 18 13 18C13 18 17.6907 18 18.8604 17.7015C19.5058 17.5372 20.014 17.0531 20.1865 16.4385C20.5 15.3244 20.5 13 20.5 13C20.5 13 20.5 10.6756 20.1865 9.56153Z" fill="white"/>
<path class="icon-main-color icon-youtube" d="M11.4658 15.1104L15.3863 13.0001L11.4658 10.8896V15.1104Z" fill="#FF0000"/>
</g>
<defs>
<clipPath id="clip0">
<rect width="15" height="10" fill="white" transform="translate(5.5 8)"/>
</clipPath>
</defs>
</svg>
</a>
</li>
</ul>
</div>
</div>
<div class="article-comments" id="article-<?php echo $post_id;?>-comments__container">
<div class="commentsform__container">
<h3 class="comments-title" id="comments">Комментарии <span class="comments-num">
(<?php
echo get_comments_number($post_id);
?>)
</span>
</h3>
<?php
// global $withcomments;
// $withcomments = true;
// comments_template();
global $current_user; wp_get_current_user();
if ( is_user_logged_in() ) {
echo '<div class="custom_logged-in-as">';
echo '<span class="custom_logged-in-name">Вы вошли как: ' . $current_user->display_name . '</span>';
echo '<a class="custom_logout"';
wp_loginout();
echo '</a>';
echo '</div>';
} else {
wp_loginout();
}
comment_form( $args = array(
), $post_id );
?>
</div>
<?php
$comments = get_comments(array(
'post_id' => $post_id,
'hierarchical' => 'threaded',
// 'parent' => $question->comment_ID,
));
if ($comments) {
echo '<ol class="commentlist">';
foreach($comments as $comment) {
$childcomments = get_comments(array(
'post_id' => $post_id,
'status' => 'approve',
'order' => 'DESC',
'parent' => $comment->comment_ID,
));
// echo '<pre>' . var_export($childcomments, true) . '</pre>';
$link = get_comment_reply_link( [
'reply_text' => "ответить",
'respond_id' => 'comment',
'depth' => 5,
'max_depth' => 10,
], $comment->comment_ID, $post_id );
$d = "F jS Y в h:i";
$comment_ID = $comment->comment_ID;
$comment_date = get_comment_date( $d, $comment_ID );
$user_id = strstr($comment->comment_author_email, '@', true);
echo '<li class="comment user-'. $user_id .'">';
echo '<div class="comment-body">';
echo '<p class="comment-author">' . $comment->comment_author . '</p>';
echo '<div class="comment-meta commentmetadata">';
echo '<span class="comment-date">' . $comment_date . '</span>';
echo '<a class="comment-edit-link" href="' . get_edit_comment_link( $comment->comment_ID ) . '">Изменить</a>';
echo '</div>';
echo '<p class="comment-context">'. $comment->comment_content . '</p>';
echo $link;
echo '</div>';
if($childcomments) {
echo '<ul class="children">';
foreach($childcomments as $childcomment) {
$link = get_comment_reply_link( [
'reply_text' => "ответить",
'respond_id' => 'comment',
'depth' => 5,
'max_depth' => 10,
], $childcomment->comment_ID, $post_id );
$d = "F jS Y в h:i";
$comment_ID = $comment->comment_ID;
$comment_date = get_comment_date( $d, $comment_ID );
$user_id = strstr($comment->comment_author_email, '@', true);
echo '<li class="comment depth-2 user-'. $user_id .'">';
echo '<div class="comment-body">';
echo '<p class="comment-author">' . $childcomment->comment_author . '</p>';
echo '<div class="comment-meta commentmetadata">';
echo '<span class="comment-date">' . $comment_date . '</span>';
echo '<a class="comment-edit-link" href="' . get_edit_comment_link( $childcomment->comment_ID ) . '">Изменить</a>';
echo '</div>';
echo '<p class="comment-context">'. $childcomment->comment_content . '</p>';
echo $link;
echo '</div>';
echo '</li>';
}
echo '</ul>';
}
echo '</li>';
}
echo '</ol>';
}
?>
</div>
</article>
<div class="article-aside">
<?php
$posttags = get_the_tags(get_the_ID());
if ($posttags) {
$tagslugforaside = $posttags[0]->slug;
}
else {
$tagslugforaside = novosti;
}
echo $tagslugforaside;
get_template_part('template-parts/latest-news', get_post_type(), array(
'posts_number' => 6,
'tag_slug' => $term->slug,
'block_header' => 'Материалы по теме'
));
wp_reset_postdata();
?>
</div>
</div>
<?php
echo $post_id;
if ($show_fin_offer_widget) {
echo get_template_part('blog-posts/tag-banner-banki');
} elseif ($show_ipoteka_widget){
echo get_template_part('blog-posts/tag-banner-ipoteka');
} else {
}
?>
</div>
</span>
</div> <!-- end of wrapper -->
<div id="load_articles_holder"></div>
</div>
</div>
</div>
</main>
<?php
endwhile;
wp_reset_postdata();