0

I create template customsearch.php, adding this for page example.com\search.html (ID page: 18)

    <?php
    /*
    Template Name: CustomSearch
    */
    
    get_header(); ?>
    
    <div id="primary">
            <div id="content">
        
    <script async src="https://cse.google.com/cse.js?cx=000000000000000000000:uiyuiyiyiuyui"></script>
    <div class="gcse-search"></div>
</div>
</div>
    
    <?php get_sidebar(); ?>
    <?php get_footer(); ?>

How to this page adding for example.com?q=xxxxxx

Result:

example.com/?s=xxxxxx - default search wordpress

example.com/?q=xxxxxx - google custom search

Sorry for my English

P.S.

I want to keep a default search

  • So all you need to do is add this new URL format, so that ?q=x goes to your new search page? – mozboz Jul 15 at 16:27
  • Yes, to search from the search.html script – UserUser-name Jul 15 at 16:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.