Support » Fixing WordPress » Custom Search Box – wordpress

  • I am trying to customize my search. As I am using ticketing platform on subdomain, so I want to customize my search to search under subdomain when user hit search button.

    For example: when user hits search button I want following query string:<query from searchbox>

    How can I do this?

Viewing 6 replies - 1 through 6 (of 6 total)
  • Is this URL working :<query from searchbox> ?

    I guess it should rather be

    If so, you can just modify the search widget of wordpress. Modify the form action so it’ll redirect you to your sudomain’s search.
    form action=""

    However if you are trying to display results from your subdomain on your actual domain, this is not the way to do it.

    No i am trying to display results on sub-domain itself. So currently i have 2 files (searchform.php) and search.php. Following are codes:

    `<form method=”get” id=”searchform” action=”<?php echo esc_url( home_url( ‘/’ ) );”>
    <label for=”s” class=”assistive-text”><?php _e( ‘Search’, ‘voyage’ ); ?></label>
    <input type=”text” class=”search-query” name=”s” id=”s” placeholder=”<?php esc_attr_e( ‘Search’, ‘voyage’ ); ?>” />
    <input type=”submit” class=”submit” name=”submit” id=”searchsubmit” value=”<?php esc_attr_e( ‘Search’, ‘voyage’ ); ?>” />


    <?php if ( have_posts() ) : ?>
    			<header class="page-header">
    				<h1 class="page-title"><?php printf( __( 'Search Results for: %s', 'voyage' ), '<span>' . get_search_query() . '</span>' ); ?></h1>
    			<?php voyage_content_nav( 'nav-above' ); ?>
    			<?php while ( have_posts() ) : the_post(); ?>
    				<?php get_template_part( 'content', 'summary' ); ?>
    			<?php endwhile; ?>
    			<?php voyage_content_nav( 'nav-below' ); ?>
    		<?php else : ?>
    			<?php get_template_part( 'content-none' ); ?>
    		<?php endif; ?>


    I tried putting your code [action=””] but its still searching in main website.

    Sorry.. the sub-domain query is ….<searchterm>


    So you want the results from the WordPress search on the main domain displayed on your subdomain which is not running WP


    you want that when i enter a search term in WP and then hit the button i am redirected to your subdomain with my searchterm and it is your ticketing platform on which i will actually perform the search ?

    2nd option – ” i enter a search term in WP and then hit the button i am redirected to your subdomain with my searchterm”

    <form method="get" id="searchform" action="">
    <label for="s" class="assistive-text"><?php _e( 'Search', 'voyage' ); ?></label>
    <input type="text" class="search-query" name="search_kwd" id="s" placeholder="<?php esc_attr_e( 'Search', 'voyage' ); ?>" />
    <input type="submit" class="submit" name="submit" id="searchsubmit" value="<?php esc_attr_e( 'Search', 'voyage' ); ?>" />

    Something like this should work.
    Redirect the form to the other search form and submit the correct variable name.
    You will eventually need to modify the name attribute of the submit button too.

    The basic idea is that you send variables to your subdomain’s search form which have the same names as what this search form actually expects.

    You could even try to copy the whole code of your subdomain to your WP template. Just make sure the form action contains the correct URL (the one of your subdomain)

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Custom Search Box – wordpress’ is closed to new replies.