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 (this tutorial is specific to sites running on the Genesis Framework).
Include a search box on a page or post in your Genesis theme
My original task was to update a post I wrote last year 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.
That’s when I stumbled on it. In the latest update to his plugin, Bill included a cool search box shortcode. If you’re using Bill’s plugin, you can go ahead and use this search shortcode anywhere in your site:
Go ahead, copy it and use it!
If you’re not using the plugin, here’s the code you can add to your Genesis theme to add search shortcode support (say that 3x fast!).
Place this in your theme’s function.php file (or wherever you add customized code to your theme):
That’s it! Now you can insert
[genesis-404-search] into your post or page and a search form will magically appear. Thanks Bill for writing awesome code!
Want to see it in action? Here it is!
What do you think? Have another method to add code for a WordPress search box? Maybe a way that’s not specific to the Genesis Framework? Leave a comment below and let’s discuss!