WordPress.org

Make WordPress Core

Opened 14 months ago

Closed 14 months ago

Last modified 12 months ago

#23451 closed feature request (worksforme)

Organize/Tag media library items into galleries

Reported by: abdessamad idrissi Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Media Keywords:
Focuses: Cc:

Description

The new media library in 3.5 is great! The only thing missing is a way of organizing/tagging the items in the library into categories that would be accessed from the theme.

Something like; get_gallery($gallery_id, $args)

Some of the arguments would be;

  • src [Boolean]; allows to return only the src of the images
  • etc..

Of course there's a lot of plugins out there such as the NextGen Gallery but it's too much for such a simple thing.

There's also the option to create galleries within posts/pages and using the short-code [gallery] to access them but for this, a media must be associated with a post/page :(

Change History (10)

comment:1 markoheijnen14 months ago

  • Keywords close added

I have no clue what you are talking about. The title is about organizing/tagging but the example is about getting galleries.
I would say that this ticket is invalid since the gallery is a shortcode and there is no way to use a function for getting a gallery.

Your last sentence seems the old way of doing gallery. In 3.5 you can have multiple galleries and the media file doesn't have to be associated with the page/post

comment:2 abdessamad idrissi14 months ago

Sorry for the misunderstanding.

To understand this ticket, let's examine this situation; Using the core functions of WordPress (which means without the help of any plugin) how can I organize a bunch of hundreds of media files (jpg/gif/png images that I have uploaded into my media > Library) inside galleries that I can retrieve in my theme?

Not only I want to retrieve them, but also, I want some control over their display; I need a function to get the link to images (withing my created gallery) without any pre-formatting (<ul><li>.. etc.)

And one last thing; It is not true that In 3.5 you can have multiple galleries and the media file doesn't have to be associated with the page/post.

comment:3 helen14 months ago

Perhaps you are looking to turn on taxonomies for attachments so that you can retrieve them in an organized way? In which case, you can do that now, for example: register_taxonomy_for_object_type( 'category', 'attachment' );

There are many functions for retrieving attachments and image-specific information. Not sure what you're asking for core to do.

comment:4 follow-up: DrewAPicture14 months ago

It sounds like you're talking about two different things, like @markoheijnen points out:

  1. Wanting attachment categories (or similar), which is already possible via register_taxonomy() as @helen mentions in comment:3.
  1. Wanting some kind of gallery endpoint, which was briefly discussed near the end of the 3.5 cycle, but probably won't happen, at least in 3.6. As it is, "galleries", that is, "galleries of unattached images" are really just one-time groups of images displayed via a shortcode. An endpoint for effectively "reusing groups of unattached images" would be a nice future enhancement. There may be a "re-usable gallery" ticket around here somewhere, but I can't find it.

+1 for close or modifying the ticket with a better focus.

comment:5 markoheijnen14 months ago

What you describe seems plugin territorium. You can play with the shortcode and using taxonomies in them and then control the display with the filter 'post_gallery'. But everything you describe till now doesn't seem something that should be in core.

comment:6 markoheijnen14 months ago

  • Keywords close removed
  • Milestone Awaiting Review deleted
  • Resolution set to worksforme
  • Status changed from new to closed
  • Version trunk deleted

comment:7 in reply to: ↑ 4 SergeyBiryukov14 months ago

Related: #22960

comment:8 Funkatronic12 months ago

To me, this is the exact use case where having post to post relationships in core. In fact, I'm writing a plugin that would do this: the ability to images together in galleries that can then be used in multiple posts.

Basically, the old way of doing galleries was attaching media to posts via the posts_parent field of a post, except this was a one to many relationship; the post could have multiple images but the images only had one parent. The current way uses shortcode but the only way to use that gallery elsewhere would be to parse the content of that post or copy and paste the shortcode.

Using a posts relationship scheme like scrivu's Posts 2 Posts plugin, you could setup a many to many relationship with media and a gallery post type. The gallery post type could hold many images and the images could be attached to multiple galleries or posts or whatever you want. The galleries could them have their own single/archive/category pages or could be embedded in posts, widget areas, etc.

My inspiration for this is how tech news sites like theverge.com handle media galleries. They have a whole section of media galleries for products and events but those same galleries can be embedded into their news stories and articles. Because the galleries are their own entities and aren't specifically linked to one article, you can re-use them in multiple related articles if you so wished.

I think this would be an awesome feature for WP and using a P2P table to make this happen just makes sense.

Related: #14513

Last edited 12 months ago by Funkatronic (previous) (diff)

comment:9 follow-up: nacin12 months ago

Persistent galleries was something we considered in 3.5, but it is not something core should attempt for the time being. I strongly agree that this is currently plugin territory.

comment:10 in reply to: ↑ 9 Funkatronic12 months ago

Replying to nacin:

Persistent galleries was something we considered in 3.5, but it is not something core should attempt for the time being. I strongly agree that this is currently plugin territory.

I'm curious to the hurdles that came up with doing persistent galleries.

Last edited 12 months ago by Funkatronic (previous) (diff)
Note: See TracTickets for help on using tickets.