Support for Envato Buyers Forums OldCar Search for featured image for post shows no results

Viewing 11 reply threads
  • Author
    Posts
    • #6869
      feimineach
      Member

      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.

    • #6872
    • #6874
      feimineach
      Member

      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.

    • #6878

      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

    • #6885
      feimineach
      Member
      This reply has been marked as private.
    • #6889

      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

    • #6891
      feimineach
      Member

      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.

    • #6895

      It’s my pleasure and glad to hear that 🙂

    • #8523
      feimineach
      Member
      This reply has been marked as private.
    • #8525

      Hi

      Done, please check.

    • #8532
      feimineach
      Member

      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!

    • #8534

      Great! It’s my pleasure!

Viewing 11 reply threads
  • You must be logged in to reply to this topic.