WordPress Search Box

Add WordPress Search Box Code in 5 Minutes Flat

Have you ever been off doing a task and gotten totally side-barred by a different idea? Happens to me all the time!

Crap. What was I talking about?

Oh yeah, so I got sidetracked this morning, but I made a cool discovery and thought I’d share it with you:

I’ll show you how to add a WordPress search box to a post or page.

Include a WordPress search box on a page or post in any theme

My original task was to update a post I wrote awhile back on creating a custom 404 page with an html sitemap. There are lots ways to skin that cat, so to speak, and part of my research had me poking around the code for Bill Erickson’s Genesis 404 Page plugin.

Using that as inspiration, here’s some code you can use to achieve the effect, but without a plugin.

Place this in your theme’s functions.php file (or wherever you add customized code to your theme – Genesis Extender is a great option if you’re using the Genesis Framework):

TADA!

That’s it! Now you can insert [404-search] into your post or page and a search form will magically appear. Thanks Bill for the inspiration!

33 thoughts on “Add WordPress Search Box Code in 5 Minutes Flat”

Leave a Comment

Your email address will not be published. Required fields are marked *

Carrie Dils uses Accessibility Checker to monitor our website's accessibility.