Skip to content

A simple proof of concept for overloading `post_parent` to create one-to-many/many-to-one relationships. Like Posts 2 Posts but much, much worse.

Notifications You must be signed in to change notification settings

chrisguitarguy/One-to-Many

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

One to Many
===========

A poor man's post to posts.

Overload WordPress' `post_parent` column for creating one to many (or many to
one, if you prefer) relationships.

Very light weight, but also very inflexible and not as full featured as something
like Posts 2 Posts.

Usage
-----

Register a new post type, but pass in the `otm_parent` argument which should
contain a string or array of post types which you want to to be "parents" of
the post type being registered.

    <?php
    /** Plugin Name: Some Plugin */
    add_action('init', function () {
        register_post_type('some_type', array(
            // other stuff here...
            // 'otm_parent'     => 'page',
            'otm_parent'    => array('post', 'page'),
        ));
    });

About

A simple proof of concept for overloading `post_parent` to create one-to-many/many-to-one relationships. Like Posts 2 Posts but much, much worse.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages