Description
This filter is used to change the registered Conductor Widget displays. This filter is used to register Conductor Widget displays.
Note: Conductor Widget displays are expected have a unique ID (array key).
Note: Registered Conductor Widget displays will likely require CSS adjustments on the front-end. Styling for registered Conductor Widget displays is left up to the developer.
This filter is executed when the Conductor_Widget::__construct()
function is called (when a Conductor Widget instance is created).
Conductor Widget Display Data Structure (array keys and values):
The following list outlines the parameters which can be used when registering a Conductor Widget display with an array of configuration data.
Note: Conductor Widget displays can be registered with a string for the “value” or an array of data for the “value” (see examples below).
Note: At a minimum, Conductor Widget display data must contain a label (whether the “value” is a string or an array). Custom data can be added under any parameter that is not listed below.
If the Conductor Widget display is registered with an array for the value, the following structure can be used:
label (string): Label for this content layout, should be unique, shown below the display preview in the Conductor Widget
customize (array) (optional): Customizable Conductor Widget properties for this display
columns (Boolean, array): Allow for column customization, if Boolean (true) columns can be customized for both single and many queried pieces of content
single (Boolean): Allow for column customization on single queried pieces of content
many (Boolean): Allow for column customization on many queried pieces of content
defaults (array) (optional): Conductor Widget properties to set defaults for when this display is selected
columns (int): Number of columns to default to when this display is selected (cannot be smaller than 1 and cannot be larger than the maximum number of columns value)
output (array): Output element properties to default to when this display is selected, array key must match ID of output element (see examples below)
link (Boolean): Whether or not this output element should be linked, must be used on an output element which supports linking
visible (Boolean): Whether or not this output element should be visible
post_thumbnails_size (string): Featured image size to default to when this display is selected
Conductor Widget Display Data Examples:
Small:
__( 'Small', 'conductor' )
Flexbox:
array( 'label' => __( 'Custom', 'conductor' ), 'customize' => array( 'columns' => true ) )
Custom Widget Display with Data:
array( 'label' => __( 'My Custom Display', 'text-domain' ), 'customize' => array( 'columns' => array( 'single' => false, 'many' => true ) ), 'defaults' => array( 'columns' => 2, 'output' => array( // Featured Image 'featured_image' => array( 'link' => false ), // Author Byline 'author_byline' => array( 'visible' => false ), // Read More 'read_more' => array( 'visible' => false ) ), 'post_thumbnails_size' => 'thumbnail' ) )
Technical Details
Type: Filter
Parameters:
$displays (array): Default Conductor Widget displays
$instance (array): Previously a Conductor Widget instance (settings), currently an empty array (likely to be deprecated or replaced in a future version)
$widget (Conductor_Widget): Conductor_Widget instance
Return Value: array
Resources
- View on GitHub
Class: Conductor_Widget
conductor_widget_settings_display_preview
conductor_widget_settings_display_preview_{$size}
conductor_widget_defaults
conductor_widget_instance
conductor_widget_admin_localize
conductor_widget_query_callback_prefix
conductor_widget_update
conductor_widget_max_columns
Examples
The following example registers Conductor Widget displays. It can be used in conjunction with the examples on the conductor_widget_settings_display_preview
and conductor_widget_settings_display_preview_{$size}
documentation pages.