Is it possible to filter categorized images on the frontend?
-
I would like to have a website portfolio built with categorized images. Is it possible to filter categorized images from the native image gallery on the frontend? Thank you!
-
Thanks for your question. If, by “the native image gallery“, you mean the WordPress
[gallery]
shortcode the short answer is no. WordPress does not support adding category, tag or custom taxonomy terms to Media Library items. The latest WordPress versions will display category and tag assignments on the Media/Library admin submenu if support has been added by the theme or a plugin, but[gallery]
does not allow filtering by taxonomy terms.Plugins like MLA add taxonomy support to Media Library items. the
[mla_gallery]
shortcode can compose a gallery filtered by taxonomy terms, and the[mla_tag_cloud]
and[mla_term_list]
shortcodes make it possible to add term selection capability to your posts and pages. You can find more information and examples in the Settings/Media Library Assistant Documentation tab.I am marking this topic resolved because the immediate question has been answered. If you have problems or further questions regarding taxonomy support in MLA, post an update here or start a new support topic. Thanks for your interest in the plugin.
Hmm, Im reading it and unfortunately I was not able to make it works. I have an image category called “seguradora”. How can I get just the images from it? Thank very very much for your support! ??
If you are using MLA and the
[mla_gallery]
shortcode, can you post the complete source text of your shortcode and its parameters? I can have a look and give you more specific help.[mla_gallery category=”seguradora”]
Sorry, but it seems I didn`t understand its sintax. Thank you!Thanks for your update with the additional information. The syntax looks fine and the
category=seguradora
parameter is correct if you have assigned your terms in the WordPress Categories taxonomy.You must have the correct taxonomy name in your parameter. For the Att. Tags and Att. Categories built in to MLA, use
attachment_tag
andattachment_category
. If you have added support for the WordPress taxonomies by checking the box on the Settings/Media Library Assistant General tab and assigned terms in those taxonomies you can usepost_tag
ortag
andcategory
orcategory_name
.You can tell which taxonomy you are using by looking at the column header in the Media/Assistant admin submenu.
Hmm, ok, but that will bring me just the attachment images linked to their pages right? Or can I open an external website inside a lighbox with your plugin as well? Thank you!
The
[mla_gallery]
shortcode has dozens of parameters that give you extensive control over the format and content of your gallery display. I encourage you to look theough the documentation and examples to see what’s possible.[mla_gallery]
has been put to use with many lightbox plugins. Here are a couple of earlier topics with more information:How to add popup of full image from gallery page?
I hope that gives you some ideas for your application. I am marking this topic resolved, but please update it if you have any problems or further questions about adapting
[mla_gallery]
for your application.Sorry, but I still don`t know if it is possible to have an external link being opened in a lightbox when I click on an image with you plugin or not. Tks.
I do not understand what you mean by “open an external website inside a lighbox. Can you give me more details and/or a specific example?
https://esites.pro/escolher-site/
As it is all the images are loaded on the same time without a good filter, ajax or infinite scroll. I would like that, but with a better filter scheme. Tks.-
This reply was modified 8 years, 1 month ago by
diegpl.
It looks like your gallery is fairly standard except for the
href
attribute of the links behind each item. It looks like you are using the “WP Gallery Custom Links” plugin to supply thehref
value; is that right?I believe that WP Gallery Custom Links works by intercepting the hooks built in to the WordPress
[gallery]
shortcode. If that’s true you can use MLA’s “Support for Other Gallery-generating Shortcodes” to give the same results. For example, try something like:[mla_gallery category=”seguradora” mla_alt_shortcode=gallery]
You can add other parameters required by
[gallery]
or WP Gallery Custom Links.With the
mla_alt_shortcode
parameter,[mla_gallery]
does the filtering and generates anids=
parameter with the IDs of the selected items. Then, control is passed to[gallery]
to format the gallery display. Give it a try and let me know how it works for you.As an alternative you can just access the links provided by as custom field values. Here’s what their FAQ says:
#4) I’d like to use the custom link in my own gallery code or in a different custom layout. How can I get the custom link?
The custom links are stored as meta values for images, and can be accessed with the following:
$custom_url = get_post_meta( $attachment_id, '_gallery_link_url', true );
Please note that “$attachment_id” is a variable for the post ID of the image – you will need to have already defined and set this variable in your own code and use your variable in this spot. “$attachment_id” is just an example of what it could be named.
For example, you can try:
[mla_gallery category=”seguradora” mla_link_href="{+custom:_gallery_link_url+}"]
Hmm, I was not able to even make this part of the code to work:
[mla_gallery category=”seguradora”]
And I saved the permalink options and created more categories to test it up as well. What am I doing wrong? It does not appear anything, it appears just one image when I type just
[mla_gallery]
Im I missing any feature I need to enable? Thank you.This code worked: [mla_gallery ids=”1630,1631″ mla_link_href=”{+custom:_gallery_link_url+}”]
But the one that was supposed to filter by category did not: [mla_gallery category=”seguradora” mla_link_href=”{+custom:_gallery_link_url+}”]
Do you know tell me why? Thank you a lot!!!It seems that the right code is [mla_gallery attachment_category=”engenharias,seguradora” mla_link_href=”{+custom:_gallery_link_url+}”]
Right? But it is still not showing the filter to be browsed from, how can I set it up? Thank you! -
This reply was modified 8 years, 1 month ago by
- The topic ‘Is it possible to filter categorized images on the frontend?’ is closed to new replies.