To show the category
1. Enable Author in the admin panel of the plugin by ticking the box. (Display Metadata, Display author & date for every search result)
2. Stop Date from showing With a bit of CSS tweaking, you should be there. Add this to your css.
1 2 3 4 5 |
.daves-wordpress-live-search_date { display: none; } |
3. Replace below code in plugins\daves-wordpress-live-search\class-daves-wordpress-live-search-results.php
Compare what you have in class-daves-wordpress-live-search-results.php with code below. Paste this after if ( $displayPostMeta ) {
All the way up to $post->post_author_nicename = $dog; Maybe replace the $dog or what ever you have!
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
if ( $displayPostMeta ) { //xxxxxxxxxxxxxxxxxxxxxxxxxxxxx Codehaven CODE xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx $post = $wp_query->post; $dog=$post->ID; $category = get_the_category( $dog ); $dog = $category[0]->cat_name; $dog = get_cat_ID( $dog ); //show cat id number from its name like "Tricks" (child) foreach (get_the_category() as $cat) { // yay shows parent category for each $dog there is $parent = get_category($cat->category_parent); $dog = $parent->cat_name; } $authorName = get_the_author_meta( 'user_nicename', $post->post_author ); $authorName = apply_filters( 'dwls_author_name', $authorName ); $post->post_author_nicename = $dog; } //xxxxxxxxxxxxxxxxxxxxxxxxxxxxx Codehaven CODE xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx |