0

Introduction:

I am developing a wordpress website and want to use the Visual Portfolio plugin (https://wordpress.org/plugins/visual-portfolio/). This plugin gives me the ability to display a gallery of posts. It also gives me the ability query my posts with a custom query string:

field in the visual portfolio plugin where I add in a custom query

What I want to do:

I want the visual portfolio plugin to query all images in my media library with the category gallery.

What I have done:

I have used the F4 Media Taxonomies plugin (https://wordpress.org/plugins/f4-media-taxonomies/) to give categories to my images. According to that plugin's directions, I have added the following code to my functions.php to enable the taxonomy category:

add_action('init', function() {
    register_taxonomy_for_object_type('category', 'attachment');
});

Next, on the page where I create my Visual Portfolio gallery (screenshot above), I add in the following query string:

post_type=attachment&post_mime_type=image&post_status=inherit&tax_query[0]taxonomy=category&tax_query[1]term=gallery&tax_query[2]field=slug

What happens:

The Visual Portfolio plugin simply displays all the images in my media library, not just images with category gallery.

Any ideas? Thanks

  • Instead of term=gallery try category=gallery – Tim Hallman Jan 15 at 0:01
  • This gives me the same result; the plugin displays all the images in my media library. – Ben393 Jan 15 at 12:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.