add files
This commit is contained in:
25
template-parts/search/search-ajax-load-more.php
Normal file
25
template-parts/search/search-ajax-load-more.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<!--[search/search-ajax-load-more]-->
|
||||
|
||||
<?php
|
||||
|
||||
$index_alm_shortcode = '
|
||||
[ajax_load_more
|
||||
cache="true"
|
||||
cache_id="' . get_alm_cache_id() . '"
|
||||
container_type="div"
|
||||
post_type="profile_article,anew,yellow"
|
||||
repeater="template_26"
|
||||
posts_per_page="10"
|
||||
post_format="standard"
|
||||
search="'. trim(strip_tags(get_query_var('s'))) .'"
|
||||
offset="8"
|
||||
id="archive"
|
||||
category="' . get_queried_object()->slug . '"
|
||||
]';
|
||||
|
||||
echo do_shortcode( $index_alm_shortcode );
|
||||
|
||||
?>
|
||||
|
||||
|
||||
<!--[/search/search-ajax-load-more]-->
|
||||
19
template-parts/search/search-form.php
Normal file
19
template-parts/search/search-form.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<!--[search/search-form]-->
|
||||
|
||||
<form class="searchform" action="/">
|
||||
|
||||
<button class="searchform__btn" type="submit">
|
||||
|
||||
<svg viewBox="0 0 24 24" class="align-baseline svg-icon">
|
||||
|
||||
<use xlink:href="/wp-content/themes/profile/assets/img/sprites-svg/dist/sprite.svg#lens"></use>
|
||||
|
||||
</svg>
|
||||
|
||||
</button>
|
||||
|
||||
<input name="s" type="search" placeholder="Поиск по сайту" value="<?= trim(strip_tags(get_query_var('s'))); ?>" />
|
||||
|
||||
</form>
|
||||
|
||||
<!--[/search/search-form]-->
|
||||
53
template-parts/search/search-list-item.php
Normal file
53
template-parts/search/search-list-item.php
Normal file
@@ -0,0 +1,53 @@
|
||||
<!--[search/search-list-item]-->
|
||||
|
||||
<div class="newslist__item"
|
||||
itemscope
|
||||
<?php if( get_post_type() == "profile_article"): ?>
|
||||
itemtype="https://schema.org/Article"
|
||||
<?php else: ?>
|
||||
itemtype="https://schema.org/NewsArticle"
|
||||
<?php endif; ?>
|
||||
>
|
||||
|
||||
<?php get_template_part("template-parts/micro/post"); ?>
|
||||
|
||||
<div class="d-flex">
|
||||
|
||||
<div>
|
||||
|
||||
<div class="newslist__body">
|
||||
|
||||
<h3 class="newslist__title">
|
||||
|
||||
<a href="<?= the_permalink() ?>">
|
||||
|
||||
<?= the_title() ?>
|
||||
|
||||
</a>
|
||||
|
||||
</h3>
|
||||
|
||||
<a href="<?= the_permalink() ?>" class="d-none d-md-block mb-4">
|
||||
|
||||
<?= get_first_paragraph() ?>
|
||||
|
||||
</a>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="publication__data">
|
||||
|
||||
<?php get_template_part("template-parts/post/list-item-date") ?>
|
||||
|
||||
<?php get_template_part("template-parts/post/list-item-author") ?>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<!--[/search/search-list-item]-->
|
||||
11
template-parts/search/search-results.php
Normal file
11
template-parts/search/search-results.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<!--[search/search-results]-->
|
||||
|
||||
<?php while ( have_posts() ) : ?>
|
||||
|
||||
<?php the_post(); ?>
|
||||
|
||||
<?php get_template_part( "template-parts/search/search-list-item" ) ?>
|
||||
|
||||
<?php endwhile; ?>
|
||||
|
||||
<!--[search/search-results]-->
|
||||
39
template-parts/search/search.php
Normal file
39
template-parts/search/search.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<!--[search/search]-->
|
||||
|
||||
<?php get_header();?>
|
||||
|
||||
<div class="col-12 col-md-12 col-xl-9">
|
||||
|
||||
<?php get_template_part( "template-parts/search/search-form" ) ?>
|
||||
|
||||
<?php if( !!!get_query_var("s") ) : ?>
|
||||
|
||||
<p class="mt-4">Введите запрос для поиска.</p>
|
||||
|
||||
<?php else: ?>
|
||||
|
||||
<?php if( have_posts() ) : ?>
|
||||
|
||||
<?php get_template_part( "template-parts/search/search-results" ) ?>
|
||||
|
||||
<?php get_template_part( "template-parts/search/search-ajax-load-more" ) ?>
|
||||
|
||||
<?php else: ?>
|
||||
|
||||
<p class="mt-4">Ничего не найдено.</p>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="col-12 col-md-4 col-xl-3 d-none d-xl-block">
|
||||
|
||||
<?php get_template_part( "template-parts/sidebar/right-sidebar" ) ?>
|
||||
|
||||
</div>
|
||||
|
||||
<?php get_footer(); ?>
|
||||
|
||||
<!--[/search/search]-->
|
||||
Reference in New Issue
Block a user