views:

14

answers:

1

I am looking at creating a selection pretty similar to the posts and categories in Wordpress admin page.

When you add a new post you can select multiple categories that it belongs too.

I have a video and playlist plugin that I need to associate with one another.

How would I go about achieving this?

+1  A: 

Are you asking how to do this in the database, or in the UI?

In the database, you will need a many-to-many relation table (video_id, playlist_id).

In the UI, the easy way is to do it like the categories, and display a checkbox before each playlist. If you want it with autocompletion like the tags, you will need some AJAX tricks. You can get inspiration in wp-admin/includes/meta-boxes.php, in the functions post_tags_meta_box and post_categories_meta_box.

If you can adapt your code to use custom taxonomies, you will get all this for free.

Jan Fabry