Answer the question
In order to leave comments, you need to log in
How to display search results in a modal window in Wordpress?
Hello.
For modal windows I use fancy box.
The search form looks like this:
<form role="search" method="get" id="searchform" class="searchform" action="<?php the_permalink(); ?>">
<div class="search icon-search">
<input type="submit" class="submit icon-search various" value="Search">
<input type="text" value="<?php echo get_search_query() ?>" name="s" id="s" class="input" placeholder="Site search">
</div>
</form>
<div id="modal3" class="forma" style="display:none">
<form id="form">
<?php printf( __( 'Результаты поиска: %s', 'twentyten' ), '' . get_search_query() . '' ); // Динамический заголовок поиска?>
<?php if ( have_posts() ) while ( have_posts() ) : the_post(); // Начало цикла ?>
<div class="category-text">
<h3 class="entry-header"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
<div class="date"><?php the_time('F j, Y'); // Дата создания поста ?></div>
<?php if ( has_post_thumbnail() ) { the_post_thumbnail(); } // Проверяем наличие миниатюры, если есть показываем ?>
<?php the_content(); // Содержимое страницы ?>
</div>
<?php endwhile; // Конец цикла ?>
<div class="pagination"><?php // Пагинация
global $wp_query;
$big = 999999999;
echo paginate_links( array(
'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),
'format' => '?paged=%#%',
'current' => max( 1, get_query_var('paged') ),
'type' => 'list',
'prev_text' => __('« Назад'),
'next_text' => __('Вперед »'),
'total' => $wp_query->max_num_pages
) );
?></div>
</form>
<a href="#modal" class="various ">Write to admin</a>
<input type="submit" onsubmit="location.href='#modal3';" class="various" value="Search">
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question