2017 © Pedro Peláez
 

library objects-to-objects

A WordPress plugin/module that provides the ability to map relationships between posts and other post types

image

voceconnect/objects-to-objects

A WordPress plugin/module that provides the ability to map relationships between posts and other post types

  • Wednesday, April 6, 2016
  • by voceconnect
  • Repository
  • 19 Watchers
  • 33 Stars
  • 2,867 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 7 Forks
  • 3 Open issues
  • 28 Versions
  • 2 % Grown

The README.md

Objects to Objects Build Status

Contributors: prettyboymp, klangley, csloisel, markparolisi, jeffstieler
Tags: relationships, mapping, connections, many-to-many
Requires at least: 3.6
Tested up to: 4.4
Stable tag: 1.4.5
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html, (*1)

A WordPress plugin/module that provides the ability to map relationships between posts and other post types., (*2)

Description

This plugin provides a development layer on top of WordPress' taxonomy system that simplifies the ability to create many-to-many relationships between post types., (*3)

Installation

As standard plugin:

See Installing Plugins., (*4)

As theme or plugin dependency:

After dropping the plugin into the containing theme or plugin, add the following:, (*5)

if( ! class_exists( 'O2O' ) ) {
    require_once( $path_to_o2o . '/objects-to-objects.php' );
}

Usage

Registering a connection

Relationships are registered directly through the O2O::Register_Connection() method., (*6)

Parameters

  • $name (string) - A string used as the lookup key when referencing the connection at later points.
  • $from_object_types (array, string) - An array of object or post types that act as the parent for the connections. Note that because O2O uses WP's taxonomy system as it's data interface, care should be taken in deciding which object types are the from object vs the to object since options like sorting can't be applied to both directions of the connection.
  • $to_object_types (array, string) - An array of object or post types that the from types can be connected to.
  • $args (array) - An array of options for the connection
    • reciprocal (boolean) - Default: false. By default, the ability to make connections is only displayed on the edit screen for the $from_object_types.
    • rewrite (mixed) - Options: false, 'from', 'to'. Default: false. When set to 'to', rewrite rules will automatically be added to supply an endpoint that lists the attached to objects of a single post object. When set to ```'from'`` the rewrite rule will be added that lists the attahed from objects.
    • to - (array) - An array of options specifically applied to the interface of connecting to objects.
      • sortable (boolean) - Default: false. When true, the user can set an order to the connected objects.
      • limit (integer) - Default: null. When set, the interface that allows users to add connected items stops allowing new connections to that object once the limit is reached.
      • labels (array) - The labels to use with the connection interface.
        • name (string) - The plural label to use when describing the connected objects.
        • singular_name (string) - The singular label to use when describing the connected objects.
    • from - (array) - An array of options specifically applied to the interface of connecting from objects.
      • limit (integer) - Default: null. When set, the interface that allows users to add connected items stops allowing new connections to that object once the limit is reached.
      • labels (array) - The labels to use with the connection interface.
        • name (string) - The plural label to use when describing the connected objects.
        • singular_name (string) - The singular label to use when describing the connected objects.
    • metabox - (array) - An array of options specifically applied to the metabox user interface
      • orderby (string) - Default: post_date. Field to order the posts by within the metabox.
      • order (string) - Default: DESC. Order, ASC or DESC, to display the posts within the metabox.
      • context (string) - Default: side. Context to display the metabox on the post edit screen. Options are side, normal, and advanced.

Example

add_action('init', 'register_o2o_connection');
/**
 * Registers a many to many connection between posts and galleries that allows
 * related galleries to be assigned to a single post for listing.
 */
function register_o2o_connection() {
    O2O::Register_Connection('post_galleries', 'post', 'gallery', array(
        'reciprocal' => true,
        'to' => array(
            'sortable' => true,
            'labels' => array(
                'name' => 'Galleries',
                'singular_name' => 'Gallery'
            )
        ),
        'from' => array(
            'labels' => array(
                'name' => 'Posts',
                'singular_name' => 'Post'
            )
        )
    ));
}

Querying a connection

O2O provides a custom WP_Query query_var that will filter the query based on the given connection details., (*7)

  • o2o_query (array) - An array defining how a connection should be queried agaist.
    • connection (string) - The key/name of the connection being queried against.
    • direction (string) - Options 'to', 'from'. Default: 'to'. The side of the connection being queried. When set to 'to', only $to_object_types will be returned.
    • id (integer) - The ID of the post object from which the relationships will be queried.
    • post_name (string) - The post_name of the post object from which the relationships will be queried. Will only be used if id is not set.
  • o2o_orderby (string) - Set to the connection name to order the results by that connection's ordering. Note that the connection must have ordering set to true for the given direction.

The Versions

06/04 2016

dev-master

9999999-dev

A WordPress plugin/module that provides the ability to map relationships between posts and other post types

  Sources   Download

GPLv2+

The Requires

 

The Development Requires

by Michael Pretty

wordpress relationships

06/04 2016

1.4.5

1.4.5.0

A WordPress plugin/module that provides the ability to map relationships between posts and other post types

  Sources   Download

GPLv2+

The Requires

 

The Development Requires

by Michael Pretty

wordpress relationships

12/03 2016

1.4.4

1.4.4.0

A WordPress plugin/module that provides the ability to map relationships between posts and other post types

  Sources   Download

GPLv2+

The Requires

 

The Development Requires

by Michael Pretty

wordpress relationships

12/03 2016

dev-cli_db_update

dev-cli_db_update

A WordPress plugin/module that provides the ability to map relationships between posts and other post types

  Sources   Download

GPLv2+

The Requires

 

The Development Requires

by Michael Pretty

wordpress relationships

07/08 2015

1.4.3

1.4.3.0

A WordPress plugin/module that provides the ability to map relationships between posts and other post types

  Sources   Download

GPLv2+

The Requires

 

The Development Requires

by Michael Pretty

wordpress relationships

06/08 2015

1.4.2

1.4.2.0

A WordPress plugin/module that provides the ability to map relationships between posts and other post types

  Sources   Download

GPLv2+

The Requires

 

The Development Requires

by Michael Pretty

wordpress relationships

22/07 2015

1.4.1

1.4.1.0

A WordPress plugin/module that provides the ability to map relationships between posts and other post types

  Sources   Download

GPLv2+

The Requires

 

The Development Requires

by Michael Pretty

wordpress relationships

16/07 2015

1.4.0

1.4.0.0

A WordPress plugin/module that provides the ability to map relationships between posts and other post types

  Sources   Download

GPLv2+

The Requires

 

The Development Requires

by Michael Pretty

wordpress relationships

16/07 2015

1.3.1

1.3.1.0

A WordPress plugin/module that provides the ability to map relationships between posts and other post types

  Sources   Download

GPLv2+

The Requires

 

The Development Requires

by Michael Pretty

wordpress relationships

22/04 2015

1.3.0

1.3.0.0

A WordPress plugin/module that provides the ability to map relationships between posts and other post types

  Sources   Download

GPLv2+

The Requires

 

The Development Requires

by Michael Pretty

wordpress relationships

25/08 2014

1.2.4

1.2.4.0

A WordPress plugin/module that provides the ability to map relationships between posts and other post types

  Sources   Download

GPLv2+

The Requires

 

The Development Requires

by Michael Pretty

wordpress relationships

12/07 2014

1.2.3

1.2.3.0

A WordPress plugin/module that provides the ability to map relationships between posts and other post types

  Sources   Download

GPLv2+

The Requires

 

The Development Requires

by Mike Pretty

wordpress relationships

22/05 2014

v1.2.2

1.2.2.0

A WordPress plugin/module that provides the ability to map relationships between posts and other post types

  Sources   Download

GPLv2+

The Requires

 

The Development Requires

by Mike Pretty

wordpress relationships

02/05 2014

v1.2.1

1.2.1.0

A WordPress plugin/module that provides the ability to map relationships between posts and other post types

  Sources   Download

GPLv2+

The Requires

 

The Development Requires

by Mike Pretty

wordpress relationships

05/02 2014

v1.2.0

1.2.0.0

A WordPress plugin/module that provides the ability to map relationships between posts and other post types

  Sources   Download

GPLv2+

The Requires

 

The Development Requires

by Mike Pretty

wordpress relationships

24/01 2014

v1.1.0

1.1.0.0

A WordPress plugin/module that provides the ability to map relationships between posts and other post types

  Sources   Download

GPLv2+

The Requires

 

by Mike Pretty

wordpress relationships

24/01 2014

v1.0.12

1.0.12.0

A WordPress plugin/module that provides the ability to map relationships between posts and other post types

  Sources   Download

GPLv2+

The Requires

 

by Mike Pretty

wordpress relationships

09/01 2014

v1.0.11

1.0.11.0

A WordPress plugin/module that provides the ability to map relationships between posts and other post types

  Sources   Download

GPLv2+

The Requires

 

by Mike Pretty

wordpress relationships

09/01 2014

v1.0.10

1.0.10.0

A WordPress plugin/module that provides the ability to map relationships between posts and other post types

  Sources   Download

GPLv2+

The Requires

 

by Mike Pretty

wordpress relationships

17/12 2013

v1.0.8

1.0.8.0

A WordPress plugin/module that provides the ability to map relationships between posts and other post types

  Sources   Download

GPLv2+

The Requires

 

by Mike Pretty

wordpress relationships

17/12 2013

v1.0.9

1.0.9.0

A WordPress plugin/module that provides the ability to map relationships between posts and other post types

  Sources   Download

GPLv2+

The Requires

 

by Mike Pretty

wordpress relationships

11/12 2013

v1.0.7

1.0.7.0

A WordPress plugin/module that provides the ability to map relationships between posts and other post types

  Sources   Download

GPLv2+

The Requires

 

by Mike Pretty

wordpress relationships

11/12 2013

1.0.6

1.0.6.0

A WordPress plugin/module that provides the ability to map relationships between posts and other post types

  Sources   Download

GPLv2+

The Requires

 

by Mike Pretty

wordpress relationships

02/11 2013

v1.0.5

1.0.5.0

A WordPress plugin/module that provides the ability to map relationships between posts and other post types

  Sources   Download

GPLv2+

The Requires

 

by Mike Pretty

wordpress relationships

01/11 2013

v1.0.4

1.0.4.0

A WordPress plugin/module that provides the ability to map relationships between posts and other post types

  Sources   Download

GPLv2+

The Requires

 

by Mike Pretty

wordpress relationships

01/11 2013

v1.0.3

1.0.3.0

A WordPress plugin/module that provides the ability to map relationships between posts and other post types

  Sources   Download

GPLv2+

The Requires

 

by Mike Pretty

wordpress relationships

30/10 2013

v1.0.2

1.0.2.0

A WordPress plugin/module that provides the ability to map relationships between posts and other post types

  Sources   Download

GPLv2+

The Requires

 

by Mike Pretty

wordpress relationships

29/10 2013

1.0.0

1.0.0.0

A WordPress plugin/module that provides the ability to map relationships between posts and other post types

  Sources   Download

GPLv2+

The Requires

 

by Mike Pretty