PHP code example of voceconnect / objects-to-objects

1. Go to this page and download the library: Download voceconnect/objects-to-objects library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

voceconnect / objects-to-objects example snippets


if( ! class_exists( 'O2O' ) ) {
	

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'
			)
		)
	));
}
$name