Support for Envato Buyers › Forums › OldCar › Search for featured image for post shows no results
- This topic has 11 replies, 2 voices, and was last updated 9 years, 5 months ago by FocuxTheme Support.
-
AuthorPosts
-
-
November 29, 2014 at 6:41 pm #6869feimineachMember
Hi there
Can anyone advise on this issue? When I search for a featured image for my post (using the regular WP featured image window and search function), the search does not find any images. I know the images are there in my media library, and they are found when I am using any other theme, but not oldcar.
Thank you.
-
November 30, 2014 at 1:49 am #6872FocuxTheme SupportKeymaster
Hi
I found the solution here http://stackoverflow.com/questions/14940004/search-by-file-name-in-the-media-library
You can try it.
Thanks!
-
November 30, 2014 at 9:04 pm #6874feimineachMember
Hi there
Thank you so ,much for your response but I am not at all familiar with WP coding etc. so I wouldn’t be able to implement the suggestion above. Is there any other advice? Without the basic featured image search function when compiling a post, the theme is alas unusable for me.
Thanks.
-
November 30, 2014 at 10:55 pm #6878FocuxTheme SupportKeymaster
Hi
Just put the following code into theme-functions.php file. Or you can post your wordpress login details with private reply, I will help you to do that.
add_filter( 'posts_search', 'guid_search_so_14940004', 10, 2 ); function guid_search_so_14940004( $search, $a_wp_query ) { global $wpdb, $pagenow; // Only Admin side && Only Media Library page if ( !is_admin() && 'upload.php' != $pagenow ) return $search; // Original search string: // AND (((wp_posts.post_title LIKE '%search-string%') OR (wp_posts.post_content LIKE '%search-string%'))) $search = str_replace( 'AND ((', 'AND (((' . $wpdb->prefix . 'posts.guid LIKE \'%' . $_GET['s'] . '%\') OR ', $search ); return $search; }
Thanks
-
December 1, 2014 at 2:51 am #6885feimineachMemberThis reply has been marked as private.
-
December 1, 2014 at 10:13 pm #6889FocuxTheme SupportKeymaster
Fixed.
The solution:
I changed
add_filter('pre_get_posts','van_searchFilter');
to
if(!is_admin()){ add_filter('pre_get_posts','van_searchFilter'); }
This code is in the includes/theme-functions.php
Thanks
-
December 1, 2014 at 11:24 pm #6891feimineachMember
Johnny, thanks a million. I’m delighted this that my search is working now. It was a dealbreaker (and OldCar is my favourite theme).
Thanks again.
-
December 2, 2014 at 2:12 am #6895FocuxTheme SupportKeymaster
It’s my pleasure and glad to hear that 🙂
-
July 3, 2015 at 2:12 pm #8523feimineachMemberThis reply has been marked as private.
-
July 3, 2015 at 6:18 pm #8525FocuxTheme SupportKeymaster
Hi
Done, please check.
-
July 5, 2015 at 3:11 pm #8532feimineachMember
Johnny, once again, thank you!
All working perfectly again! I have copied the code this time and made a note of how to do it.
Thanks again!
-
July 5, 2015 at 11:40 pm #8534FocuxTheme SupportKeymaster
Great! It’s my pleasure!
-
-
AuthorPosts
- You must be logged in to reply to this topic.