Answer the question
In order to leave comments, you need to log in
How to display bitrix smart filter in search?
I'm trying to display the component in search.php, with the parameters as in section.php, but the filter does not appear. What could be the reason?
Is there any other way to get it out? Or is it not in the search results?
Answer the question
In order to leave comments, you need to log in
Do you want to filter the search result with a smart filter? Will not work.
Because you output pagination after resetting the cycle. Correct code:
<?php
$args = array( 'post_type' => 'post', 'category' => 'voprosyi', 'posts_per_page' => 5);
$the_query = new WP_Query( $args );
while ( $the_query->have_posts() ) {
$the_query->the_post();
$qname = get_field("faq_name");
$qtext = get_field('faq_text');
$qdate = get_the_date('j F Y', $post->ID);
$aname = get_field('faq_answer_name');
$atext = get_field('faq_answer_text');
echo '<div>';
echo '<div class="faq-date">Спрашивает <time>'.$qdate.'</time></div>';
echo '<div class="author"><span>'.$qname.' </span>:</div>';
echo '<div itemprop="text"><p>'.$qtext.'</p></div>';
echo '<div class="answer""><div class="faq-date">Отвечает <time>'.$qdate.'</time></div>';
echo '<div class="answer-author"><span>'.$aname.':</span></div>';
echo '<div itemprop="text"><p>'.$atext.'</p></div></div></div>';
}
?>
<nav>
<ul class="pagination">
<?php the_posts_pagination(); ?>
</ul>
</nav>
<?php wp_reset_postdata(); ?> <!-- сброс цикла - в самом конце -->
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question