WordPress.org

Ready to get started?Download WordPress

Forums

Advance WP Query Search Filter
Display Search Results on a Specific Page (30 posts)

  1. in omnia paratus
    Member
    Posted 1 year ago #

    Hi there,

    I would like to know how can I display the search results on a specific page?

    Also, I have multiple boxes (that are working trough a drop down plugin that shows more information as it opens) that are the target of the search. But when I have the search results, the title of this box appears but as a permalink, not has the intended box with its content. How can I fix it?

    Tks

    http://wordpress.org/extend/plugins/advance-wp-query-search-filter/

  2. TC.K
    Member
    Plugin Author

    Posted 1 year ago #

    The plugin using your theme search.php template by default. So you can customize your search.php in order to fit your need.

    Here is how have to do:
    in the search.php while loop

    if(wp_verify_nonce($query->query_vars['s'], 'awqsfsearch') ) //this will verify that the search is from the plugin
    {
    //here you can add your own style of your result.
    }
    else{
    goto your default search result style.
    }
  3. thatwastaxing
    Member
    Posted 1 year ago #

    Thanks! How do I use this if I have 2 different search forms based on 2 different CPTs that have different results templates for each?

  4. thatwastaxing
    Member
    Posted 1 year ago #

    Might it be possible to choose which template we want to use for the serch results in your next update? Thanks!

  5. TC.K
    Member
    Plugin Author

    Posted 1 year ago #

    Hi,

    How do I use this if I have 2 different search forms based on 2 different CPTs that have different results templates for each?

    Well, it can. By just editing the code above:

    if(wp_verify_nonce($query->query_vars['s'], 'awqsfsearch') ) //this will verify that the search is from the plugin
    {
     if($_GET['formid'] == '111'){
        //template for your form with id = 111
      }
       if($_GET['formid'] == '222'){
        //template for your form with id = 222
      }
    
    }
    else{
    goto your default search result style.
    }

    Might it be possible to choose which template we want to use for the serch results in your next update?

    It is possible, but will be not included in near future. Depends on my workload and times.

  6. naghmeh
    Member
    Posted 10 months ago #

    Hi,
    Thank you for helping me on my last problem, I have a new question.

    I'm using Portfolio plus as theme, which is an elaborated version of Portfilio press (http://wordpress.org/themes/portfolio-press).

    The main page of this theme contains all the pictures of my projects, each picture is also a link to a page.

    My current "search result page" shows a list of the project's name.

    Is it possible to show results on the main page by keeping just the result pictures and hiding the rest?
    Or, is it possible to show results on a page which looks like the main page and contains the picture of all the projects filtered by "Advance WP Query Search Filter"?

    I appreciate it if you can help me with this problem.

  7. TC.K
    Member
    Plugin Author

    Posted 10 months ago #

    You can refer to your theme's index.php (or home.php) to see how the theme developer create the template. And you can use it in your customized search result page.

  8. naghmeh
    Member
    Posted 9 months ago #

    Hi,
    I tried hard to fix it but I'm not good in coding and I don't know how to proceed.
    Could you please tell me if you can help me with this?
    I'm using Portfolio plus theme and the search.php contains:

    <?php
    
    get_header(); ?>
    
    	<div id="primary">
    		<div id="content" role="main">
    
    			<?php if ( have_posts() ) : ?>
    
    				<header class="page-header">
    					<h1 class="page-title"><?php printf( __( 'R├ęsultat de recherche', 'portfolioplus' ), '<span>' . get_search_query() . '</span>' ); ?></h1>
    				</header>
    
    				<?php /* Start the Loop */ ?>
    				<?php while ( have_posts() ) : the_post(); ?>
    
    					<?php get_template_part( 'content', 'search' ); ?>
    
    				<?php endwhile; ?>
    
    				<?php portfolioplus_content_nav(); ?>
    
    			<?php else : ?>
    
    				<article id="post-0" class="post no-results not-found">
    					<header class="entry-header">
    						<h1 class="entry-title"><?php _e( 'Aucun r├ęsultat', 'portfolioplus' ); ?></h1>
    					</header><!-- .entry-header -->
    
    					<div class="entry-content">
    						<p><?php _e( 'Effectuez une nouvelle recherche en cliquant sur l\'onglet "Projets"', 'toolbox' ); ?></p>
    
    					</div><!-- .entry-content -->
    				</article><!-- #post-0 -->
    
    			<?php endif; ?>
    
    			</div><!-- #content -->
    		</div><!-- #primary -->
    
    <?php get_sidebar(); ?>
    <?php get_footer(); ?>

    The index.php contains:

    <?php
    
    get_header(); ?>
    
    	<div id="primary">
    		<div id="content" role="main">
    
    			<?php if ( have_posts() ) : ?>
    
    				<?php /* Start the Loop */ ?>
    				<?php while ( have_posts() ) : the_post(); ?>
    
    					<?php
    						/* Include the Post-Format-specific template for the content.
    						 * If you want to overload this in a child theme then include a file
    						 * called content-___.php (where ___ is the Post Format name) and that will be used instead.
    						 */
    						get_template_part( 'content', get_post_format() );
    					?>
    
    				<?php endwhile; ?>
    
    				<?php portfolioplus_content_nav(); ?>
    
    			<?php else : ?>
    				<?php get_template_part( 'content', 'none' ); ?>
    			<?php endif; ?>
    
    			</div><!-- #content -->
    		</div><!-- #primary -->
    
    <?php get_sidebar(); ?>
    <?php get_footer(); ?>

    Thank you in advance

  9. thad
    Member
    Posted 9 months ago #

    Hello,

    I'm attempting to have 2 different custom results pages for different forms, I have modified your code above:

    <?php
    
    if(wp_verify_nonce($_GET['s'], 'awqsfsearch') ) //this will verify that the search is from the plugin
    {
     if($_GET['formid'] == '7810'){
        include 'search-industry-partners.php' ;
      }
    
      if($_GET['formid'] == '7840'){
        include 'search-architect-directory.php' ;
      }
    
    } else { ?>

    For the second form, ID 7840 - every time I run a search, I get the results page for the first form, ID 7810.

    I tried using an else statement instead and got a white screen.

    Any ideas as to what could be causing this?

    Thank you

  10. TC.K
    Member
    Plugin Author

    Posted 9 months ago #

    Maybe the search form '7840' doesn't exist?

  11. thad
    Member
    Posted 9 months ago #

    Hi TC,

    The form exists and is displaying on page.

  12. thad
    Member
    Posted 9 months ago #

    I was able to resolve the issue by removing the meta filter of 'title' that I had selected. I assumed this would have been for the post title but I think a co-worker setup a custom meta field called 'title'.

  13. aeboi80
    Member
    Posted 8 months ago #

    I am having some issues with displaying a custom search results page. I have edited my default wordpress search.php file within my template to include the if/else snippet you provided above, but I am unable to get the search to return the custom search template. It always displays the default wordpress search template.

    Here is the contents of my search.php file

    <?php if ( have_posts() ) : ?>
    
    			<?php while ( have_posts() ) : the_post(); ?>
    
    				<?php
    					if(wp_verify_nonce($query->query_vars['s'], 'awqsfsearch') ) //this will verify that the search is from the plugin
    					{
    					 if($_GET['formid'] == '86') {
    					    //template for your form with id = 86
    					    //get_template_part( 'content', 'museumsearch' );
    					    echo 'museum search results';
    					  }
    
    					}
    					else{
    					echo 'normal wp search results';
    					//get_template_part( 'content', 'search' );
    					}
    				?>
    
    			<?php endwhile; ?>
    
    			<?php bluehive_sassy_press_content_nav( 'nav-below' ); ?>
    
    		<?php else : ?>
    
    			<?php get_template_part( 'no-results', 'search' ); ?>
    
    		<?php endif; ?>

    No matter what I do, it continues to echo out normal wp search results. I have verified that my form id is definitely 86 as that is the form id which was generated and used to place on the wp page.

  14. TC.K
    Member
    Plugin Author

    Posted 8 months ago #

    Try to remove if(wp_verify_nonce($query->query_vars['s'], 'awqsfsearch') ){} check.

  15. aeboi80
    Member
    Posted 8 months ago #

    I removed the f(wp_verify_nonce($query->query_vars['s'], 'awqsfsearch') ){} check. as suggest, however that unfortunately yielded the same result. Its still returning the default search. This site is using the starter _s underscores theme form WordPress. Very little has been modified from it.

  16. aeboi80
    Member
    Posted 8 months ago #

    DOH! Never mind. That did fix it. It turns out my FTP program was being dumb. Thank you! Any idea why WP wouldn't be able to verify the nonce awqsfsearch ? I looked at the plugin code and I see that its instantiating the nonce.

  17. TC.K
    Member
    Plugin Author

    Posted 8 months ago #

    @aeboi80, there are alot of reasons. Can't tell what is it. Maybe it is the theme or caused by other plugin problem.

  18. Xanderrr
    Member
    Posted 8 months ago #

    Hi there,

    Iam running into some problems while trying to set up my Advance WP Query Search Filter search forms.....
    I have 4 different search forms and i want to display the search results on (4) different specific pages (templates)

    My search.php file:

    ------------------------------------------------------------------------
    <?php
    /*
    Template Name: Search Page
    */
    get_header(); ?>

    <div id="container">

    <div id="page">

    <div id="tekst">

    <div id="sidebar">

    "><img src="<?php bloginfo('template_directory'); ?>/images/logo.png" alt="Naar Home"> <!-- logo -->

    <h2>T: +31 (0)6 145 144 10</h2>

    <div id="verhuurknop"> ">VERHUUR</div>
    <div id="verkoopknop">VERKOOP</div>

    <div id="sidebarwidget">

    <?php echo do_shortcode("[awsqf-form id=12]"); ?> <!-- zoekopties in sidebar -->

    <?php get_sidebar(); ?>

    </div>

    </div> <!-- einde sidebar -->

    <div id="tekstblok">

    <div id="titel">

    <h1><?php the_title(); ?></h1> <!-- titelpagina -->

    </div> <!-- einde titel pagina -->

    <div id="tekstcontent1kolom"> <!-- een kolom template -->

    <div id="post">
    <? /*Begin Content area Query*/ ?>
    <?php if (have_posts()) : ?>
    <?php while (have_posts()) : the_post(); ?>
    <?php endwhile; ?>
    <?php

    if(wp_verify_nonce($query->query_vars['s'], 'awqsfsearch') ) //this will verify that the search is from the plugin
    {
    if($_GET['formid'] == '12'){
    include 'search.php' ;
    }
    if($_GET['formid'] == '128'){
    include 'search-us.php' ;
    }
    if($_GET['formid'] == '191'){
    include 'search-verkoop.php' ;
    }
    if($_GET['formid'] == '595'){
    include 'search-verkoop-us.php' ;
    }
    else { ?>
    }
    <? /*End Content area Query*/ ?>

    </div>

    </div> <!-- einde tekstblok -->

    </div>
    <?php get_footer(); ?>
    ------------------------------------------------------------------------

    When I use this on the website i get a server error, what am i doing wrong?!

    Thanks in advance,

    Kind regards,
    Xander

  19. TC.K
    Member
    Plugin Author

    Posted 8 months ago #

    What is the error message?

  20. Xanderrr
    Member
    Posted 8 months ago #

    Hi,

    Thanks for the fast reply, this is the error message:

    Server error
    The website encountered an error while retrieving . It may be down for maintenance or configured incorrectly.
    Here are some suggestions:
    Reload this webpage later.
    HTTP Error 500 (Internal Server Error): An unexpected condition was encountered while the server was attempting to fulfill the request.

  21. TC.K
    Member
    Plugin Author

    Posted 8 months ago #

    Seem like the server error.
    There are many possibilities.

    How many filter you have in your search form? If it is too many filter, maybe you should reduce the filters.

    Or, it might be conflict with other plugin. Do you have other search plugin activated?

    Some time corrupt .htaccess File or exceeding PHP Memory Limit of your server can cause this problem as well.

    So in a nutshell, you'll need to diagnose all the possibilities above.

  22. Xanderrr
    Member
    Posted 8 months ago #

    Thanks for your feedback.

    I combined all the searchforms/filters on/in one page, for now that will do :)

    Have a good weekend!

  23. twowarm
    Member
    Posted 5 months ago #

    <?php
    					if(wp_verify_nonce($query->query_vars['s'], 'awqsfsearch') )
    //this will verify that the search is from the plugin
    					{
    					 if($_GET['formid'] == '3267') { //include 'search-movies.php' ;
    					    //template for your form with id = 3267
    					    //get_template_part( 'content', 'museumsearch' );
    					    echo 'movie search results';
    					  }
    
    					}
    					else{
    					echo 'normal wp search results';
    					//get_template_part( 'content', 'search' );
    					}
    				?>

    I use the code above. The search results page always shows 'normal wp search results'.

    It just doesn't work.

  24. twowarm
    Member
    Posted 5 months ago #

    What do you mean by Try to remove if(wp_verify_nonce($query->query_vars['s'], 'awqsfsearch') ){} check.

  25. twowarm
    Member
    Posted 5 months ago #

    Never mind. I nailed it.

  26. septem
    Member
    Posted 5 months ago #

    hi i installed so sitemap plugin but not getting my website statitics pls rply me

  27. twowarm
    Member
    Posted 5 months ago #

    <?php 
    
    //if(wp_verify_nonce($query->query_vars['s'], 'awqsfsearch') ) {}
    
     if($_GET['formid'] == '3267'){
         include 'search-movies.php' ;
    
      }
       if($_GET['formid'] == '3268'){
        echo '3268 search results';
      }
    
    else{
    
    include 'searchbackup.php' ;
    
      }
    				?>

    http://itransl.com/?s=7d0d251485&formid=3267&taxo%5B0%5D%5Bname%5D=movie_country&taxo%5B0%5D%5Bterm%5D=wqsftaxoall&taxo%5B1%5D%5Bname%5D=movie_year&taxo%5B1%5D%5Bterm%5D=1971&skeyword=&wqsfsubmit=Search

    First, it uses custom results template. Then, it uses normal wp results template. Why? Please help.

  28. twowarm
    Member
    Posted 5 months ago #

    Well I have to disable normal WP search and replace it with awqsfsearch

  29. twowarm
    Member
    Posted 5 months ago #

    echo '<div class="awqsf_box"><p class="awqsf-button"><input type="submit" id="awqsf_submit" value="'.$options[0]['button'].'" alt="[Submit]" name="wqsfsubmit" title="Search" /></p></div>';
    echo '<input type="hidden" name="lang" value=" <?php echo qtrans_getLanguage(); ?> ">'; 
    
    echo '</form>';

    the search result is like this: http://itransl.com/?s=9eab94f60d&formid=3321&skeyword=+First+Avenger+&wqsfsubmit=Search&lang=+echo+qtrans_getLanguage%28%29%3B+

  30. twowarm
    Member
    Posted 5 months ago #

    Why doesn't <?php echo qtrans_getLanguage(); ?> work?

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic