Skip to content

Instantly share code, notes, and snippets.

@jamiemitchell
Forked from cdils/search_shortcode.php
Created March 29, 2018 22:06
Show Gist options
  • Select an option

  • Save jamiemitchell/4ab0cb16adcc263ab72744a8c1a81d26 to your computer and use it in GitHub Desktop.

Select an option

Save jamiemitchell/4ab0cb16adcc263ab72744a8c1a81d26 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