WordPress.org

Ready to get started?Download WordPress

Forums

Search in Place
[resolved] Attachment search issues (6 posts)

  1. fallenartist
    Member
    Posted 1 year ago #

    When searching, the plugin correctly finds attachments (images) by name but doesn't display their thumbnails, which is odd.

    Also, when a name is entered into the search field, image attachments are correctly displayed in the list BUT after clicking "more results" button the results page is empty ("Nothing found").

    Finally, after deleting a term in the field the hovering window with results doesn't disappear.

    I'm using basic version.

    http://wordpress.org/extend/plugins/search-in-place/

  2. codepeople
    Member
    Plugin Author

    Posted 1 year ago #

    Hi,

    Could you send me the link to your website for checking the issue, please?

    If you prefer send me the contact through the support page in our website for give you a personalized support.

    http://wordpress.dwbooster.com/support

  3. fallenartist
    Member
    Posted 1 year ago #

    Hi,
    The site is behind maintenance mode redirect at the moment. I sent you an email via the support page. Thanks.

  4. fallenartist
    Member
    Posted 1 year ago #

    Hello again,

    Is there a way to search through both attachment names AND captions?

    Thanks.

  5. codepeople
    Member
    Plugin Author

    Posted 1 year ago #

    Hi,

    In the current version of plugin is not possible to search by the caption of images, but with a simple change in the plugin code is possible the searching by caption too:

    Open the searchinplace.clss.php file for edition and go to the snippet of code:

    $posts = array_merge($wp_query->posts, $wpdb->get_results("SELECT * FROM $wpdb->posts WHERE post_type='attachment' AND post_status='inherit' AND (post_title LIKE '$s%' OR post_content LIKE '$s%' OR post_name LIKE '$s%') AND post_parent IN (SELECT ID FROM $wpdb->posts WHERE post_status='publish') LIMIT $limit", OBJECT));

    Modifies the previous piece of code as below:

    $posts = array_merge($wp_query->posts, $wpdb->get_results("SELECT * FROM $wpdb->posts WHERE post_type='attachment' AND post_status='inherit' AND (post_title LIKE '$s%' OR post_content LIKE '$s%' OR post_name LIKE '$s%' OR post_excerpt LIKE '$s') AND post_parent IN (SELECT ID FROM $wpdb->posts WHERE post_status='publish') LIMIT $limit", OBJECT));

    This feature will be included in the current version of the plugin.

    Best regards.

  6. codepeople
    Member
    Plugin Author

    Posted 1 year ago #

    Hi,

    I'm sorry, I've forgot the percent symbol (%)

    $posts = array_merge($wp_query->posts, $wpdb->get_results("SELECT * FROM $wpdb->posts WHERE post_type='attachment' AND post_status='inherit' AND (post_title LIKE '$s%' OR post_content LIKE '$s%' OR post_name LIKE '$s%' OR post_excerpt LIKE '$s%') AND post_parent IN (SELECT ID FROM $wpdb->posts WHERE post_status='publish') LIMIT $limit", OBJECT));

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic