0

I've created two custom post types -- one for Activities and one for Places. Any post under Activities needs to be associated with a Places and I was wondering what the best approach would be in order to accomplish this.

Ideally, I could create a new Place and use the Post Title when adding the new Activity post, but am not sure how to do this or if it's even possible. Can this be done? If not, would it be best to set up a taxonomy for Places then link the custom post types for Activities and Places to it? (seems kind of redundant though, since the Places are already created based on the post title)

Here's an example of what I'm trying to do:

Places

  • Beach
  • Pool
  • Cafeteria

Activities

  • Surfing
  • Volleyball
  • Pie eating contest

When I create the new post "Pie Eating Contest" under Activities, I need to select that it's under "Cafeteria" in places. I would also like to list all Activities that are going on in the Cafeteria on another page. Each of the items I listed above need to have their own "post" within WordPress so visitors can view information about each place/activity.

1 Answer 1

1

Taken literally your question is about post to post relationships. Bad news — WordPress core doesn't do post to post relationships. However there are some solutions ranging from frameworks like Posts 2 Posts to plugins like Post Connector.

Stepping a bit back though, structure you are describing strongly implies grouping of posts. The mechanism for such in WP is custom taxonomies (core taxonomies being categories and tags for example).

If you create Place and Activity as taxonomies then you get pretty much everything out of the box — from UI in post editor to archives and querying. The only limitation would be just how much info you want to cram into individual place/activity items (terms of taxonomy). They aren't to be intended as content heavy as posts and many less tools focus on enabling complex data for them.

1
  • I think ACF plugin can help you. Use relationships field to connect between posts.
    – vol4ikman
    Apr 3, 2016 at 19:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.