-
-
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/
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
.live-search-uri { | |
color: #ccc; | |
} |
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 | |
// 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