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:
[genesis-404-search]
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):
TADA!
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!



Aha! Nice one. I was thinking of writing the same tutorial when I noticed Bill updated his plugin to include the shortcode for search form. But since you’ve wrote this tutorial, now I don’t have to dig the code. Feel so great being in this AWESOME #genesiswp community
Great resource Carrie! Thanks for the tip!
I never noticed the MASSIVE featured image area on your blog before. I like it!
It’s for the hard of seeing.
What?!?
Eh… worth knowing.
Thanks for picking it up and sharing.
Now about that custom 404 page….
Your new theme look awesome
So does this article
Been a long time Genesis user and just found your blog a few weeks ago. Thanks for all the code info and also for the humor. Already see a bunch of stuff here I wanna read here.
Thanks, Bill! Always nice to get a new
victimreader around here.Hey Carrie,
I don’t know why, but it didn’t work for me until I altered line 3 to this:
[pre]add_shortcode( ‘genesis-404-search’, array( $this, ‘search_shortcode’ ) );[/pre]
But now that I got it working I’m going to use it on my new theme.
Not sure if when I hit submit the code will get mangled or not….
-rd
Oops, I meant to paste this line….
add_shortcode( ‘genesis-search’, ‘search_shortcode’ );
Are you calling the shortcode then with [genesis-search] instead of [genesis-404-search]?
Yeah, I got rid of the 404 since I’m not using the search box on a 404 page.