Skip Navigation

[Resolved] Tag photos and photographers with relevant taxonomy terms

This support ticket is created 4 years, 6 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

Author
Posts
#1334463

Hey Christian,
I dunno if this should be another split topic. I have a CPT for photographers and have thought to create a custom taxonomy to assign tags (hierarchical @ this point) to photos by certain photographers. How do I assign a photographer credit (taxonomy, set for now if best, or can be CFG select or whatever) per photo by author who uploads with photographer status (Access)? Each photo they upload to whatever post type will carry their photographer tag/category for reference on their individual photographer profile as well as where they upload it (ie. tour, activity, accommodation, post/page). Hopefully I've explained this correctly and you can help.
Shaun

#1334583

How do I assign a photographer credit (taxonomy, set for now if best, or can be CFG select or whatever) per photo by author who uploads with photographer status (Access)?
Okay if you want to assign taxonomy terms to photos, then you must create a photos custom post type. I'm not clear from your other ticket if you plan to do this, or if you were planning to use a repeating image field to store these photos as custom field values. If it's the latter, it isn't possible to assign taxonomy terms to individual custom field values like this. Instead, you would create a Photo post type to store the image. Then you could assign taxonomy terms to that Photo post.

However, I'm not sure I understand why a taxonomy is necessary. Let's say each User is the author of only one Photographer post. That User is also the author of one or more Photo posts. Listing the Photographer information for a Photo doesn't require an additional taxonomy unless I'm misunderstanding something. You can query the Photo post author, then use that in a View of Photographers filtered by post author to display the Photographer information.

Each photo they upload to whatever post type will carry their photographer tag/category for reference on their individual photographer profile as well as where they upload it (ie. tour, activity, accommodation, post/page). Hopefully I've explained this correctly and you can help.
Let's come back to this once we have determined whether you want to use taxonomy terms or not, and whether you need a Photos post type or not.

#1336997

Hey Christian,
Now that I have started to add content to the site I understand my issue a little better and have some questions as to how to proceed. The media (images) which has already been added to the (specifically) Tours and Activities CPTs (hundreds so far) each have a photographer logo/credit embedded. I want to assign each picture/image/media to a specific photographer user so that the images can be pulled from whatever CPT they are attached to and displayed as a gallery on the photographer's CPT 'profile page'. This is where I thought of using a tag-type taxonomy and just adding 1 per picture, as then I can just go through the images already uploaded to sort them further under each photographer cpt/user pair.

I do, though, love your thought to create a cpt for Photos, but this will only cover images to be uploaded (or not? you tell me) still to the Photos cpt, in the future. I understand the shortcomings of the built-in Media PT and how it can't be related to (ie. media-many-to-user-one) to users or posts other than the built-in author, etc.

I also thought maybe to create a Gallery cpt which has a 1-to-many relationship to the Photos cpt and would allow me to easily paginate the Gallery cpts per chosen Gallery group of Photos (at the photographers' discretion topically or otherwise). But I fear too that this would only cover the future uploads after the creation.

I guess my question, after your beautiful ideas to further my own, is:

"What is the best way to assign a photographer to each of the already uploaded, media-post-type-only, images which have already been used on the various other post-types so as to be able to list/view them on the photographer profile cpt as well (understanding that I have been the only author)? And is there a way to create Photo cpt posts (after cpt creation) from these already uploaded assets in my Media Library?"

#1337143

What is the best way to assign a photographer to each of the already uploaded, media-post-type-only, images which have already been used on the various other post-types so as to be able to list/view them on the photographer profile cpt as well (understanding that I have been the only author)?
I can brainstorm some options with you to help you decide.
- You can change the post author of each Media post using a custom SQL script. This only allows one type of association - Photographer associated to Media item.
- You can enable a custom taxonomy or taxonomies for the Media post type. This allows many different types of association. For example you could have taxonomies for location, photographer, camera, subject matter, time period, etc.
- You can a custom field or fields to the Media post type, and use it to store User or Photographer ID(s), or any other arbitrary information about each item. This allows many different types of association, but is more difficult to manage because you have to navigate to the full Media post in wp-admin.
- You can create a post relationship between Media posts and Photographer posts. Post relationships have some limitations, like you can't query for related Photographers using Media fields. You can only filter by fields on the content post type displayed in a View. With WPML involved, you must always create content first in the primary language. It is not possible to use post relationships in a post that was originally created in a secondary language.

And is there a way to create Photo cpt posts (after cpt creation) from these already uploaded assets in my Media Library?"
It would require a custom SQL script and direct database manipulation, or some advanced XML / CSV manipulation using a 3rd-party export tool. In that second option, you would export to a CSV or XML document, then transform that document somehow to include the right information, then re-import that document into WordPress.

#1338273

Hey again brother,
I have decided on your suggestion and have created the Photos cpt. I have also created a tag-like taxonomy, Photographer tags, and gone through each media item to assign the appropriate photographer tag.

Is there a bit of code that you can help me with to automatically assign my custom taxonomy to photographers (CPT and User group)?

#1339173

I have also created a tag-like taxonomy, Photographer tags, and gone through each media item to assign the appropriate photographer tag.
Okay great. Can you give me an example of a photographer tag? What is the term name, and what is the slug of the term? What is the slug of the taxonomy?

Is there a bit of code that you can help me with to automatically assign my custom taxonomy to photographers (CPT and User group)?
Okay so you're saying you want to assign the photographer tag to the corresponding photographer CPT, right? Are the slugs of the photographer terms identical to the slugs of the corresponding photographer cpts? For example, let's say you have a photographer CPT "John Smith". The slug of that CPT is "john-smith", and the slug of the corresponding photographer term is also "john-smith". You want to assign the "john-smith" term to the "john-smith" post. Is that correct?

When do you want to assign this term to the post...when the John Smith post is created in wp-admin? When the John Smith post is created with Forms? Or are the posts already created and you want to add the terms using a database script?

You also mentioned a User group. I'm not sure what this means, exactly. Are you trying to associate a taxonomy term with a User profile?

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.