Skip to content

Instantly share code, notes, and snippets.

@cdils
Last active March 29, 2018 22:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save cdils/4945900 to your computer and use it in GitHub Desktop.
Save cdils/4945900 to your computer and use it in GitHub Desktop.
This is a modified extract from Bill Erickson's Genesis 404 Page plugin (https://github.com/billerickson/Genesis-404-Page). This bit of code adds shortcode support for a search form within a Genesis page or post.
<?php
add_action( 'init', 'cd_register_shortcode' );
/**
* Register shortcode with the theme
*/
function cd_register_shortcode() {
add_shortcode( '404-search', 'cd_search_shortcode' );
}
/**
* Search Shortcode Excerpt
*/
function cd_search_shortcode() {
return '<div class="404-search">' . get_search_form( false ) . '</div>';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment