MB Relationships

Descripción

MB Relationships helps you create many-to-many relationships between posts, pages or any custom post type. The plugin is lightweight and optimized for database and query performance.

The plugin allows you to create connections from posts to posts, posts to pages and so on. Then you can perform corresponding queries to retrieve posts that are connected to or from given posts.

It supports reciprocal and bi-directional relationships.

Why Do You Need Posts To Posts Relationships In WordPress?

Post relationships is a missing part in WordPress. The only «built-in» way that mimic the post relationship in WordPress is the post_parent for pages where you can create many child pages of a page (a one-to-many relationship). Unfortunately, that’s available for pages and hierarchical post types only. Besides, it’s not many-to-many relationship.

Below are some examples of posts to posts relationships that might help you see the benefit of this feature:

Creating Related Posts In WordPress

The simplest example is to manually create related posts in your WordPress website. When you edit a post, you can select posts that have similar or related content and display them in the frontend for further reading.

You can also query backward: displaying posts that link to the being read post as a reference to provide more information to your readers. With this, you don’t need a WordPress related posts plugin anymore.

Example: Events And Bands

Imagina que tienes dos tipos de contenido personalizado, evento y orquesta, donde:

  • In each event there may be multiple bands, and
  • Each band can participate in many events.

If people want to buy tickets, they could search for events in their location and see what bands are playing on a given date, or they could search for bands they like and see what date they are playing near their location.

En éste ejemplo, hemos creado una relación de varios-a-varios entre eventos y orquestas.

Bi-directional relationships

MB Relationships te permite crear relaciones bidireccionales. Podrás hacer consultas de ida y vuelva sin problemas.

Los datos se almacenan en la base de datos como un par de (from_id, to_id), así los hace independientes en cualquier sentido.

Además, en cada sentido, hay una caja meta que muestra cómo están conectados de/a. No te debes preocupar sobre la dirección de la relación nunca más.

An Alternative For The Posts 2 Posts Plugin (P2P Plugin)

MB Relationships está muy inspirado en el popular plugin Posts 2 Posts que se ha dejado de mantener. Hemos cogido la idea y le hemos realizado unas mejoras. La base del código y las estructura de los datos es muy similar.

Plugin features

  • Simple APIs: the plugin provides simple APIs for registering relationships and retrieving connected items. It integrates with existing WordPress APIs such as WP_Query,get_terms and get_users. See documentation for more information.
  • Uses custom relationship table to store relationships. That helps optimize the database storage and query performance.
  • You can create relationships between any kind of content in WordPress: posts to posts, posts to users, etc. For posts to terms and posts to users, it’s required the MB Term Meta and MB User Meta.
  • Supports creating reciprocal relationships (posts-posts, users-users, …).
  • Supports creating bi-directional relationships and easily query them.
  • Display connected items easily with shortcode.
  • Extremely lightweight and fast.

Plugin Links

Éste plugin es una extensión gratuita del plugin Meta Box, es una solución potente y profesional para crear campos personalizados y cajas meta personalizadas para webs en WordPress. Utilizando MB Relationships combinado con otras extensiones te ayudará a gestionar distintos tipos de contenido en WordPress fácilmente y hacer tu web más profesional.

Capturas

  • "Connects To" meta box
  • "Connected From" meta box
  • Database structure

Instalación

Debes instalar primero el plugin Meta Box

  • Haz clic en Plugins | Añadir nuevo y busca por Meta Box
  • Haz clic en el botón Instalar ahora para instalar el plugin
  • Después de instalarlo, haz clic en Activar plugin para activar el plugin

Instalar la extensión MB Relationships

  • Haz clic enPlugins | Añadir nuevo y busca MB Relationships
  • Haz clic en el botón Instalar ahora para instalar el plugin
  • Después de instalarlo, haz clic en Activar plugin para activar el plugin

Reseñas

4 de enero de 2019
Sadly, there is no support for this plugin. I posted a bug report here: https://wordpress.org/support/topic/sort-order-in-the-metabox-lost-or-reversed/ and here: https://github.com/wpmetabox/mb-relationships/issues/13 more than two weeks ago, but nobody bothers to reply... Edit 1: +2 stars for replying to the bug report. Edit 2: +2 stars for fixing the bug and now working really well.
Leer la 1 reseña

Colaboradores y desarrolladores

«MB Relationships» es un software de código abierto. Las siguientes personas han colaborado con este plugin.

Colaboradores

«MB Relationships» ha sido traducido a 2 idiomas locales. Gracias a los traductores por sus contribuciones.

Traduce «MB Relationships» a tu idioma.

¿Interesado en el desarrollo?

Revisa el código , echa un vistazo al repositorio SVN o suscríbete al registro de desarrollo por RSS.

Registro de cambios

1.7.0 – 2019-09-18

Added

  • Add a separate field array for field settings
  • Add order_from and order_to to API::add method

1.6.1 – 2019-07-17

Fixed

  • Make hidden param work for to side
  • Remove duplicate from query

1.6.0 – 2019-02-25

Added

  • Added support for querying by multiple relationships. See docs for details.

Changed

  • Extracted admin columns and meta boxes into their own classes
  • Renamed files and classes for clarity

1.5.0 – 2018-12-19

Fixed

  • Fixed incorrect order of items when changing order of connected items.

Changed

  • Changed the database structure by adding order_from and order_to columns to track order of items.
  • Removed reference to global $wpdb and use the global variable directly. This prevents serialize objects in some unexpected situations.

1.4.1 – 2018-10-26

Fixed

  • Fixed cannot query for posts excluded from search.
  • Fixed not showing entries in admin columns.

1.4.0 – 2018-08-24

Added

  • Added ‘closed’ and ‘autosave’ param to relationship meta boxes.

Fixed

  • Fixed indirect variable access in PHP 5.x.

1.3.2 – 2018-07-02

Changed

  • Reverted the 'post_type' => 'any' as it relates to many queries.

1.3.1 – 2018-07-02

Changed

  • Remove 'post_type' => 'any' in the query for relationship, which causes unexpected behaviour with post types that have 'exclude_from_search' => true. Developers should always set post_type in their queries. See https://bit.ly/2lPvnPk.

1.3.0 – 2018-05-25

Added

  • Added support for admin columns. See documentation for details.

1.2.0 – 2018-04-27

Added

  • Added API to get siblings items.

1.1.2 – 2018-03-08

Fixed

  • Fixed output of related posts with the same order as in the backend.

1.1.1 – 2018-02-27

Added

  • Made clones sortable

1.1.0

Added

  • Added meta box for selecting ‘from’ objects
  • Added CRUD API for relationships

1.0.0

  • Initial version