Last active
March 29, 2018 22:06
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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