Top

Daily Tip: How to Add a Codex Search Box to the WordPress Dashboard

November 21, 2010

Many times when working with WordPress you’ll need to search the codex for something. I found this handy little snippet from Jared Williams that makes searching the codex very convenient. It adds a box to the header of the WordPress dashboard, as pictured here. Type in your search and it opens in a new window.

Simply add this snippet to your functions.php file and the box will appear in your dashboard:

/**
 * ADD WP CODEX SEARCH FORM TO DASHBOARD HEADER
 */
function wp_codex_search_form() {
    echo '<form target="_blank" method="get" action="http://wordpress.org/search/do-search.php" class="alignright" style="margin: 11px 5px 0;">
        <input type="text" onblur="this.value=(this.value==\'\') ? \'Search the Codex\' : this.value;" onfocus="this.value=(this.value==\'Search the Codex\') ? \'\' : this.value;" maxlength="150" value="Search the Codex" name="search" class="text"> <input type="submit" value="Go" class="button" />
    </form>';
}
add_filter( 'in_admin_header', 'wp_codex_search_form', 11 );

Tweet This Post

Comments

Got something to say?

Bottom
Article Archive  |  This site is a historical archive of pressography.com, a WordPress plugin and theme blog that published between 2006 and 2012. It is preserved for reference and is not operated by, affiliated with, or endorsed by its original authors. Nothing here is for sale and no form on this site is active. If you are the original owner and would like this domain returned, please get in touch.