WordPress.org

Ready to get started?Download WordPress

Forums

Search & Filter
[resolved] Can this plugin be used with wordpress' images from media library? (4 posts)

  1. michelleadmin
    Member
    Posted 5 months ago #

    Is it possible to use this plugin to filter images? I'm building image galleries of different artworks and I've assigned categories to them using the Media Categories plugin. But when I go to try to select the category from the search and filter dropdown, it comes up with no results found.

    https://wordpress.org/plugins/search-filter/

  2. DesignsAndCode
    Member
    Plugin Author

    Posted 5 months ago #

    Hi michelleadmin, this is a really non standard way to use WP so I decided some time ago not to support it because of all the potential problems I would get from people in support :/

    If you want to see if this works you could try allowing the "attachement" post type by removing lines 1196, 1197 and 1206 in search-filter.php.

    So the code should go from:

    if($post_type->name!="attachment")
    {
    	$tempobject = array();
    	$tempobject['term_id'] = $post_type->name;
    	$tempobject['cat_name'] = $post_type->labels->name;
    
    	$taxonomychildren[] = (object)$tempobject;
    
    	$post_types[] = $post_type->name;
    
    }

    to:

    $tempobject = array();
    $tempobject['term_id'] = $post_type->name;
    $tempobject['cat_name'] = $post_type->labels->name;
    
    $taxonomychildren[] = (object)$tempobject;
    
    $post_types[] = $post_type->name;

    Not sure it will work but you can try it :)

    Also you can try pass the attachment post type to your shortcode - something like:

    [searchandfilter fields="search,category" post_types="attachment"]

    Let me know if you manage to get it working :)

  3. michelleadmin
    Member
    Posted 5 months ago #

    Still didn't work, it came up with no results. But thanks so much for the suggestion!! I'll look around for different solutions.

  4. DesignsAndCode
    Member
    Plugin Author

    Posted 5 months ago #

    No problem thanks for checking out the plugin :)

Reply

You must log in to post.

About this Plugin

About this Topic

Tags