Skip to content

Instantly share code, notes, and snippets.

@ricardoaiello
Last active June 7, 2016 11:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ricardoaiello/47163327865bcb99e60114cf4755f13d to your computer and use it in GitHub Desktop.
Save ricardoaiello/47163327865bcb99e60114cf4755f13d to your computer and use it in GitHub Desktop.
[Flatbase] Show post URI in live search. Related support topic: http://nicethemes.com/forums/topic/show-file-path-in-live-search/
.live-search-uri {
color: #ccc;
}
<?php
// Do NOT include the PHP opening tag
if ( ! function_exists( 'nice_livesearch_custom_title' ) ) :
add_filter( 'the_title', 'nice_livesearch_custom_title', 10, 2 );
/**
* Customize Nice Live Search results titles.
*
* @param $title
* @param $id
*
* @return string
*/
function nice_livesearch_custom_title( $title, $id ) {
if ( ! empty( $_GET['ajax'] ) ? $_GET['ajax'] : null ) { // is Live Search
$title .= '<br /><span class="live-search-uri">' . str_replace( get_bloginfo( 'url' ), '', get_permalink( $id ) ). '</span>';
}
return $title;
}
endif;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment