append font-awesome icons to title
-
Hi Team,
Please help me to get code, which can append font-awesome icons to suggested titles based on their catagories.
Currently i have tried below code, which works fine, but if the search string matches in url, then it shows in drop down search suggest box as well:foreach ( $query->posts as $post ) { $postID = $post->ID; $what_is_permalink = get_permalink( $postID ); $which_cat_search = get_the_category( $postID ); $which_cat_search = $which_cat_search[0]->cat_name; if ($which_cat_search == 'Song') { $results[] = '<i class="fa fa-music"></i>??<a href="'.$what_is_permalink.'">'.$post->post_title.'</a>'; } else { $results[] = '<i class="fa fa-video-camera"></i>??<a href="'.$what_is_permalink.'">'.$post->post_title.'</a>'; } } $results = apply_filters('wpss_search_results',$results,$query); echo join( $results, "\n" );
OUTPUT:
If you search “the mask”, it shows suggestion from url as well. so suggestion looks something like————————
The Mask Movie (1994)
————————
/movie/the-mask”/>
————————
- The topic ‘append font-awesome icons to title’ is closed to new replies.