How to create a search box inside page in WordPress

How to create a search box inside page in WordPress

Do you want to create a search box inside page for your website which is running in WordPress ?
Here is the easy solution

Step 1: Create new page . At left hand side click on page >> Add New

Step 2 : Give the title of page “Search”

Step 3: Click on text tab at right hand side top corner . Write down the given below code
Note: Replace https://sharadchhetri.com/?s= with your website link like this http://yourwebsite.com/?s=

Replace value=”Search” in code

 

<strong>Search Your Topic From Here</strong>
<br>

<form method=”get” id=”searchform” action=”https://sharadchhetri.com/?s=”/>
<input type=”text” size=”40″ name=”s” id=”s” value=”Search Linux …” onfocus=”if(this.value==this.defaultValue)this.value=”;” onblur=”if(this.value==”)this.value=this.defaultValue;”/>
<br>
<input type=”submit” id=”searchsubmit” value=”Search” />
</form>

wp

Step 4: Now click on Publish button and see the result.

6 thoughts on “How to create a search box inside page in WordPress”

  1. Hello Sharad,
    I am a newbie to word press.Please help me to solve this- I want to add a search box in a particular page of my website from where when user can search the accurate thing, for example what i want to do is there are scanned images of documents with a 4 digit unique numbers like 8888,3456 in a page where i had uploaded them which i don’t want to show publicly. Now user have to put 8888 in the search field and it should get the accurate 8888 name of image from that page where it is uploaded and if cannot found the match then it have to say that ” file not found please check the number and try again” like that.
    Or please will you help me to write a script for the above scenario?
    Thanks in advance.

    Reply
  2. I’m new to WordPress… So am I understanding this code creates a Button? I want to basically have a page that contains archived posts for each year and I want to give the user and specific search option on each page that only searches within that year on the page.

    I don’t want to screw around or remove the main site search on the right menu either.

    Can you tell me if this would work or point me in a direction that I might find an answer?

    Many thanks

    Lorraine

    Reply

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.