Navigation überspringen

[Gelöst] Media Post Relationships

This support ticket is created vor 5 Jahren, 8 Monaten. 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)

Dieses Thema enthält 7 Antworten, hat 2 Stimmen.

Zuletzt aktualisiert von Christian Cox vor 5 Jahren, 7 Monaten.

Assistiert von: Christian Cox.

Author
Artikel
#1232983

I need to create a post relationship between Media and a custom post type. Why can I not do that? Is there a way around this? Thanks!

#1233547

Hi, unfortunately there is no way to create Toolset post relationships between Media posts and other post types. The Media post type is not as flexible as other native post types in WP, hence the limitation here. You could try using taxonomy terms instead of post relationships to relate Media posts to another post type. Or you could consider using a proxy post type that represents Media posts. For example, create a CPT "MediaProxy". Create one MediaProxy post for each Media item, and embed the Media in the post content editor of the MediaProxy post. Use a post relationship between MediaProxy and other posts if needed.

#1233607

I think youre first idea suits me better. So basically I would just use the taxonomy(s) assigned to media items as a hack?

#1233858

Yes, basically that is correct. Here is one example:
- Create a custom taxonomy and assign it to Media and your other Custom Post Type.
- Create a new CPT post, and create a term in the taxonomy that matches the CPT post slug. For example, if your post is called "New Movie" and the slug is "new-movie", then you will create a term "new-movie" in the custom taxonomy. Assign this term to the New Movie post (You must repeat this process to create a new term every time a new CPT post is created).
- When new Media is added for this post, add the "new-movie" term to each Media post.
- Create a View of Media posts, filtered by taxonomy term where the term is set by the page where the View is displayed.
- Place this View in the Content Template for your single CPT and visit one of the posts on the front-end of the site. You should see all the associated Media posts.

#1235239

If I read this correctly the term needs to be assigned to the media item AND the post? Or just the media itme?

#1235295

It must be assigned to both the Media post and the other post.

#1238359

I understand what you're suggesting. Can I do something a little different:

Can I relate media custom Tag CPT User ?

IOW: if the media item has a tag of 'Joe Smith' and the CPT has 'author' = 'Joe Smith' would that work?

Also, can I relate CPT custom field details to parts of a title in a media item?

IOW: CPT has a custom field of 'phone' = 5551212 and the media item title = Outbound_5551212-+18884441414_Automatic_14141412441

#1238362

When you ask me if it will work, or if you can relate things in a specific way, I need to know exactly what you hope to accomplish. Are you trying to filter a View? Add front-end filters? A View of which post type, and where will it be displayed?