Title: Integrate in custom theme
Last modified: August 24, 2026

---

# Integrate in custom theme

 *  Resolved [Abhijoy Samaddar](https://wordpress.org/support/users/abhijoysamaddar01/)
 * (@abhijoysamaddar01)
 * [1 week, 4 days ago](https://wordpress.org/support/topic/integrate-in-custom-theme/)
 * I have a search button in banner and I want to redirect to a custom page and 
   there in a particualr block I want to show the results with while(have_posts()):
   the_post() code
   Please guide me

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Plugin Contributor [Rafał Groń](https://wordpress.org/support/users/aisearch/)
 * (@aisearch)
 * [1 week, 4 days ago](https://wordpress.org/support/topic/integrate-in-custom-theme/#post-19001226)
 * Good news first: there is no Queryra-specific code to write. Queryra hooks `pre_get_posts`
   and reorders the main search query, so an ordinary loop already gives you AI-
   ranked results. Get it working with plain WordPress search first, and Queryra
   improves the ranking underneath without you touching anything.
 * Two things have to be true, and they are almost certainly what is blocking you.
 * **1. It has to be a real WordPress search.** Your banner form must submit a field
   named `s` to the site root. If it posts to a custom URL without `s`, `is_search()`
   is false and Queryra never runs.
   `<form role="search" method="get" action="<?
   php echo esc_url( home_url( '/' ) ); ?>"> <input type="search" name="s" value
   ="<?php echo get_search_query(); ?>" /> <button type="submit">Search</button>
   </form>`
 * **2. Your results block must use the main loop.** Queryra only touches the main
   query by design. A `new WP_Query()` inside a block is skipped, so you would get
   plain keyword results there.
 * On redirecting to a custom page: you do not need to redirect anywhere. `search.
   php` in your theme **is** the custom page for search results. Put your banner
   and any other blocks around the loop:
   `<?php get_header(); ?> <section class="
   banner"><!-- your banner --></section> <div class="my-results-block"> <?php if(
   have_posts() ) : ?> <h1>Results for "<?php echo get_search_query(); ?>"</h1> 
   <?php while ( have_posts() ) : the_post(); ?> <article <?php post_class(); ?>
   > <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a> <?php the_excerpt();?
   > </article> <?php endwhile; ?> <?php the_posts_pagination(); ?> <?php else :?
   > <p>Nothing found.</p> <?php endif; ?> </div> <?php get_footer(); ?>`
 * **One trap worth knowing about:** do not set `orderby` in your template or in
   your own `pre_get_posts`. Queryra sets `orderby => post__in` to preserve the 
   relevance ranking. Overriding it re-sorts by date and silently throws the AI 
   ordering away — the results look right, but the order is wrong.
 * `get_search_query()` and pagination both keep working normally.
 * Let me know how it goes.
 *  Plugin Contributor [Rafał Groń](https://wordpress.org/support/users/aisearch/)
 * (@aisearch)
 * [1 week, 2 days ago](https://wordpress.org/support/topic/integrate-in-custom-theme/#post-19003141)
 * Hi, just checking back on this. I’ll mark it resolved for now, but if it didn’t
   work on your setup, reply here and I’ll pick it straight back up.

Viewing 2 replies - 1 through 2 (of 2 total)

You must be [logged in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fintegrate-in-custom-theme%2F%3Foutput_format%3Dmd&locale=en_US)
to reply to this topic.

 * ![](https://ps.w.org/queryra-ai-search/assets/icon-256x256.png?rev=3451403)
 * [AI Search for WooCommerce – Semantic Search](https://wordpress.org/plugins/queryra-ai-search/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/queryra-ai-search/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/queryra-ai-search/)
 * [Active Topics](https://wordpress.org/support/plugin/queryra-ai-search/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/queryra-ai-search/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/queryra-ai-search/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [Rafał Groń](https://wordpress.org/support/users/aisearch/)
 * Last activity: [1 week, 2 days ago](https://wordpress.org/support/topic/integrate-in-custom-theme/#post-19003141)
 * Status: resolved