Compare commits

...

4 Commits

5 changed files with 93 additions and 26 deletions

View File

@ -27,20 +27,57 @@ function getEndlessPostsResults($data)
$tags = get_the_tags($tag_slug); //Получаем тэги по айди
$i = 0;
$postSlugs = [];
foreach ($tags as $key => $slug){ //Создаём массив с ID тэгов
$postSlugs[] += $tags[$i]->term_id;
$i++;
if (!$tags){
$tags = 'null';
}
if (is_array($tags) && count($tags) > 0) {
$postSlugs = array_column($tags, 'term_id');
} else {
// Handle the case when no tags are found
$postSlugs = array(); // or some other default value
}
$id_from_permalink = explode('/', $link);
$id_from_permalink = explode('-', $id_from_permalink[3]);
$id = $id_from_permalink[0];
$requestedPost = get_post($id);
$requestedPostFromPermalink = get_post($id);
$requestedPost = [
'id' => $requestedPostFromPermalink->ID,
"post_author" => $requestedPostFromPermalink->post_author,
"post_date" => $requestedPostFromPermalink->post_date,
"post_date_gmt" => $requestedPostFromPermalink->post_date_gmt,
"post_content" => $requestedPostFromPermalink->post_content,
"post_title" => $requestedPostFromPermalink->post_title,
"post_excerpt" => $requestedPostFromPermalink->post_excerpt,
"post_status" => $requestedPostFromPermalink->post_status,
"comment_status" => $requestedPostFromPermalink->comment_status,
"ping_status" => $requestedPostFromPermalink->ping_status,
"post_password" => $requestedPostFromPermalink->post_password,
"post_name" => $requestedPostFromPermalink->post_name,
"to_ping" => $requestedPostFromPermalink->to_ping,
"pinged" => $requestedPostFromPermalink->pinged,
"post_modified" => $requestedPostFromPermalink->post_modified,
"post_modified_gmt" => $requestedPostFromPermalink->post_modified_gmt,
"post_content_filtered" => $requestedPostFromPermalink->post_content_filtered,
"post_parent" => $requestedPostFromPermalink->post_parent,
"guid" => $requestedPostFromPermalink->guid,
"menu_order" => $requestedPostFromPermalink->menu_order,
"post_type" => $requestedPostFromPermalink->post_type,
"post_mime_type" => $requestedPostFromPermalink->post_mime_type,
"comment_count" => $requestedPostFromPermalink->comment_count,
"filter" => $requestedPostFromPermalink->filter,
];
$result[] = ['requested-post' => $requestedPost];
$args = array( // Создаем массив с параметрами запроса
'tag__and' => $postSlugs,
'posts_per_page' => 10,
@ -52,23 +89,8 @@ function getEndlessPostsResults($data)
$posts = new WP_Query($args); // Инициализация запроса
while ( $posts->have_posts() ) {
$posts->the_post();
$tags = get_the_tags();
$postsTags ='';
$tags = get_the_tags();
foreach ($tags as $key => $tag){
$postsTags .= $tags[$i]->name;
if ($key < count($tags) - 1) {
$postsTags .= ', ';
}
$i++;
}
$actualTag = get_the_tags();
$terms = get_the_category();
$result[] = array(
'post_id' => get_the_ID(),
'id' => get_the_ID(),
'permalink' => get_the_permalink(),
);
}

View File

@ -0,0 +1 @@
body{min-height:100vh;display:flex;flex-direction:column;align-items:center;position:relative;overflow-x:hidden;overflow-y:auto;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,sans-serif;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}p,span,h1,h2,h3,h4,h5,h6,a{margin:0;padding:0}code{font-family:source-code-pro,Menlo,Monaco,Consolas,Courier New,monospace}.container{width:1440px;margin:0 auto;overflow-x:hidden}:before,:after{margin:0;padding:0;box-sizing:border-box}@media (max-width: 1441px){.container{width:100%}}.test{width:100%;display:flex;flex-direction:column;gap:30px;box-sizing:border-box}.article{width:1200px;padding:20px;display:flex;flex-direction:column;gap:15px;box-sizing:border-box;margin:0 auto}.article-top{display:flex;flex-direction:column;gap:12px}.article-top_image{width:100%;height:600px;position:relative}.article-top_image img{object-fit:cover;position:absolute;width:100%;height:100%}.article-body{width:100%}.article-body img{width:100%;height:auto}.article-body p{font-size:16px;line-height:26px}.article-body h1{font-size:36px;line-height:45px}.article-body span{font-size:12px;line-height:20px;font-weight:500;color:#767676}.article p{font-size:16px;line-height:26px}.article h1{font-size:36px;line-height:45px}.article span{font-size:12px;line-height:20px;font-weight:500;color:#767676}@media (max-width: 1500px){.article{width:60%}.article-top_image{height:400px}.article p{font-size:14px;line-height:24px}.article h1{font-size:34px;line-height:43px}}@media (max-width: 1025px){.article{width:70%}.article-top_image{height:300px}.article p{line-height:22px}}@media (max-width: 769px){.article{width:80%;padding:10px;gap:5px}.article-top_image{height:250px}.article h1{font-size:30px;line-height:40px}}@media (max-width: 551px){.article{width:93%;padding:0}.article h1{font-size:28px;line-height:35px}}@media (max-width: 426px){.article{width:97%}.article-top{gap:10px}.article-top_image{height:200px}.article span{font-size:12px;line-height:16px}}

File diff suppressed because one or more lines are too long

View File

@ -26,7 +26,9 @@ $container_class = isset($args['container_class']) ? $args['container_class'] :
// window.location.replace("http://www.w3schools.com");
</script>
<title><?php echo $title; ?><?php if ($PAGEN > 1) echo ". Страница " . $PAGEN; ?></title>
<link rel="stylesheet" crossorigin href="../../../wp-includes/js/endlessposts/index-8tue7roC.css.css">
<script>console.log('title', document.title);</script>
<script type="module" crossorigin src="../../../wp-includes/js/endlessposts/index-DbN6FUVS.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta charset="UTF-8">
<link rel="canonical" href="#" class="yoast-seo-meta-tag">

View File

@ -40,11 +40,9 @@ switch ($tax_id) {
?>
<?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>
<main <?php post_class('site-main'); ?> role="main">
<script>
<main <?php post_class('site-main'); ?> role="main">
</script>
<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); ; ?>">
@ -59,7 +57,6 @@ switch ($tax_id) {
<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>
@ -155,7 +152,7 @@ switch ($tax_id) {
// $content = apply_filters( 'the_content', get_the_content() );
// echo $content;
?>
<div id="root" style="width: 100%;"></div>
<div class="article-details__social article-details__social-bottom">
<button class="show-commmentsform">Оставить комментарий</button>
<?php