[wp-hackers] CPT VS Plugin

Leo Baiano ljunior2005 at gmail.com
Wed Nov 16 20:06:59 UTC 2011


Mike Oops, I understood everything you said but I got the impression
that the structure will be a little complex, it may be difficult to
organize so that the customer can create relations in a simple and, above
all, relationships between the entities will becomes poor.

I only have a many to many relationship in my system, this refers
to students and classes, in this case I'm using a table to relate them, as
you said, CPT, taxonomies and custom fields will not be good.

You suggested using post_parent for one to many relationships, but I would
not be as simple as not always the same entities are part of the CPT. For
example, course and class have a one to many relationship, because one can
have an ongoing series ofclasses, but I can not change any of
the taxonomies of two, soon they would have to be TLC, as I would say
that a post is class CPTson of a post of the CPT course? Is it possible?

The CPT is a good alternative, but would be back one of doubts
and difficulties in connecting the entities that worry me, because it
can become too complicated to list the information in front
and in back manage.

The alternative of creating the tables behind the advantage of having the
freedom to shape the bank, but I worry about the URL's as you would to
generate the URLs in a friendly, following the pattern of the site?

2011/11/16 Mike Schinkel <mikeschinkel at newclarity.net>

> Hi Leo:
>
> Here's how I might do it (assuming I understood your requirements and that
> you don't need lots of info about a teacher):
>
> Custom Taxonomy:
>
>        - Teacher (or People) (Could potentially also want to use Users or
> Custom Post Types here, depending on your requirements.)
>        - City(maybe?)
>
> Not sure about Students. Could be:
>
>        - Users
>        - Custom Taxonomy (Student or just People)
>        - Custom Post Type  (Student or People)
>
> Custom Post Types/Custom Fields:
>
>        - Course
>                - Applicable Teachers
>                - All other info about a course.
>
>        - Class
>                - Course ($course->ID => $class->post_parent)
>                - Teacher
>                - City
>                - Date/Time
>                - All other info about a class.
>                - Student List
>
> Basically Taxonomies are best when you really want to use them as "tags"
> to filter your posts, i.e. to get a list of all Class posts for Teacher.
>
> Custom Post Types are best when you need lots of additional information to
> go along with an item besides a simple name and description. You can added
> custom fields to CPTs and you can use categories, tags or custom taxonomies
> with them.
>
> Users are best when the people your system tracks are primarily users of
> your system.
>
> Custom Fields for CPTs is best when the data you need to keep track is
> related but simple, and you don't need build in "archive pages" for them,
> i.e. Prerequisites for a Course or Directions to a Class.
>
> You can also mirror each of these, so you could have a Person CPT that
> mirrors a User, or a Teacher CPT that mirrors a Teacher Taxonomy, but
> mirroring can be fragile and takes work to get it right.
>
> You can relate items in WordPress is a number of ways; 1-to-many CPTs can
> be handled with the post_parent field. For many-to-many you can relate CPTs
> or other items via shared taxonomy terms i.e. both Course and Class could
> use be related by terms in a "Topic" taxonomy, i.e. "PHP Development" could
> be a shared Topic term. But there is no proper many-to-many functionality
> built into WordPress; you have to build custom tables for that.
>
> Hope this helps.
>
> -Mike
> P.S. BTW, we are building a GPL plugin framework, probably ready for beta
> by end of year, that would make this really easy. It will include
> functionality for all of this, including many-to-many relationships via a
> 'wp_relationships' table...
>
> On Nov 16, 2011, at 12:25 PM, Leo Baiano wrote:
>
> > Personally, I would like you to help us to start thinking about a course
> > management system that will need to implement a customersite. My main
> > doubt is whether the best way to do this is using CPT and taxonomies or
> > create separate tables and develop a pluginlike it.
> >
> > So they can help me I will explain the context.
> >
> > In the course management system I have classes and courses. Classes
> > are formed by the junction of the course + city where the course is going
> > to happen. It is important to understand that each class has its own
> > characteristics inheriting the course only the name and description, but
> > the classes, teachers, number of jobs, etc. ... are directly related
> > to class, where to register a new class I need to inform the city,
> > state, and course specific information in this class.
> >
> > Besides, I have teachers, they are connected directly to the classroom
> > (information about the class that will be given) and the lessonis linked
> > directly to class.
> >
> > I also have students that are linked to class.
> >
> > Are there any other information but I believe they are quieter, which has
> > left me in doubt regarding the use of the CPT is on accountof
> relationships
> > and the difficulty in defining what taxonomies and which would be
> > linked CPT.
> >
> > For example, the relationship between the city, the class and course.
> Then
> > there is the relationship with the teacher and this classwith the class.
> >
> > Well, I hope you managed to explain myself properly, I rode the EER but
> > the name of the tables and fields are in Portuguese, I do not know they
> > could understand, but if someone willing to help me think this work ....
> >
> > Using CPT I have the advantage of some features ready to use WP as
> > a friendly URL for example, but
> > apparently lost a little respectin the relationship of the system
> entities.
> >
> > --
> > Amplexos,
> >
> > Leo Baiano
> > http://www.leobaiano.com
> > http://www.blog.ljunior.com
> > http://www.mcelebridades.com
> > http://www.twitter.com/leobaiano
> > _______________________________________________
> > wp-hackers mailing list
> > wp-hackers at lists.automattic.com
> > http://lists.automattic.com/mailman/listinfo/wp-hackers
>
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>



-- 
Amplexos,

Leo Baiano
http://www.leobaiano.com
http://www.blog.ljunior.com
http://www.mcelebridades.com
http://www.twitter.com/leobaiano


More information about the wp-hackers mailing list