Skip to content

Instantly share code, notes, and snippets.

View drivendevelopment's full-sized avatar

drivendevelopment

View GitHub Profile
<?php
/**
* Load a custom template for single posts.
*/
add_filter( 'template_include', function( $template ){
if ( is_single() && 'post' == get_post_type() ) {
$template = dirname( __FILE__ ) . '/templates/single-post.php';
}
<?php
/**
* Tweaks the query used for finding pages in the menus area so that if a number
* is entered in the search field, the query will look for a post with that ID
* instead of searching by the number.
*/
add_action( 'parse_query', function( $query ) {
// Only apply this to the menu quick search
if ( isset( $_POST['action'] ) && 'menu-quick-search' == $_POST['action'] ) {