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!
thanks Carrie, so much simplier than other methods I found
You bet!
Thank you.
Thanks a lot for this! Great simple piece of code that will save a lot of time.