All the information you need in one place

How to add additional events to the editorial calendar

In addition to allowing you to add external calendars and display their events in the Nelio Content editorial calendar, you can add additional events to your own calendar thanks to the nelio_content_internal_events filter.

By default, Nelio Content extends the editorial calendar if you have installed the MailPoet and/or The Events Calendar plugins to display MailPoet newsletters and events from The Events Calendar:

Editorial calendar with events from MailPoet and The Events Calendar.
Editorial calendar with events from MailPoet and The Events Calendar.

But if you want to add any other event in a personalized way, as we have said before, you can do it using the nelio_content_internal_events filter. In the following PHP code snippet you can see how to use this filter to add an additional event:

add_filter( 'nelio_content_internal_events', function( $events ) {
	return array_merge( $events, array(
			'id'              => 'my-custom-id-1',
			'date'            => '2023-01-01 12:00:00',
			'start'           => '2023-01-01 12:00:00',
			'end'             => '2023-01-01 14:00:00',
			'description'     => 'Event description',
			'color'           => '#fff',
			'backgroundColor' => '#000',
			'editLink'        => admin_url( 'post.php?post=1&action=edit' ),
			'isDayEvent'      => false,
			'title'           => 'My custom event',
			'type'            => 'my-custom-events'
	) );
} );

As you can see, in the filter you have $events as a parameter, which is the list of additional events to show in the calendar. To this list we have added another list with a single element that has the following attributes:

  • id: (string) identifier of the event.
  • date: (string) date of the event.
  • start: (string, optional) start date of the event.
  • end: (string, optional) end date of the event.
  • description: (string, optional) description of the event.
  • color: (string, optional) hexadecimal representation of the color of the event text.
  • backgroundColor: (string, optional) hexadecimal representation of the background color of the event.
  • editLink: (string, optional) if the event is editable, the event’s edit URL.
  • isDayEvent: (boolean, optional) Indicates whether the event is for the whole day.
  • title: (string) title of the event.
  • type: (string) type of the event, used to group events of the same type, such as "mailpoet-newsletter".

Therefore, it is easy to extend the editorial calendar of Nelio Content to add additional events that you are interested in showing. This is especially useful for including in the calendar events from other plugins that you have installed in your WordPress or that you use in an external tool that has an access API.