Home » Docs » Hooks » Filters » Class: Conductor_Widget » conductor_widget_defaults

Description

This filter is used to change the default settings for Conductor Widgets.

This filter is executed when the Conductor_Widget::__construct() function is called (when a Conductor Widget instance is created).

Conductor Widget Default Settings Data Structure (array keys and values):

The following list outlines the default values for Conductor Widget settings.

  • title (string): Widget title
    • Default: false
  • feature_many (Boolean): Type of query, whether or not many (true) or single (false) pieces of content will be queried
    • Default: false (single)
  • post_id (int): ID for single piece of content, used only if feature_many is set to false
    • Default: false
  • content_type (string): Content type for queried data, typically this will match a registered post type
    • Default: 'post'
  • query_args (array): Query arguments used for querying many pieces of content, used only if feature_many is true, most arguments are passed to WP_Query on Conductor_Widget_Default_Query
    • post_type (string): Post type for queried data, must match a registered post type
      • Default: 'post'
    • orderby (string, array): Determines what the results of the query are ordered by, must be a valid WP_Query orderby parameter
      • Default: 'date'
    • order (string): Order for the results of the query
      • Default: 'DESC'
    • max_num_posts (string, int): Used only in Conductor_Widget_Default_Query to determine the maximum number of posts for a particular query, can be set to an empty string to ensure that all content pieces are queried
      • Default: get_option( 'posts_per_page' ) (10)
    • posts_per_page (string, int): Number of posts per page for the queried content pieces, can be an empty string to set the WP_Query posts_per_page parameter to either max_num_posts or the total count for the post_type queried (which ever is the lower value)
      • Default: empty string
    • offset (int): Number of posts to offset (which content piece to start at), the Conductor Widget offset parameter is offset by 1 (i.e. a value of 2 actually sets the WP_Query offset parameter to 1)
      • Default: 1
    • cat (int): Category ID used in queries with a post_type of 'post'
      • Default: false
    • post__in (string): Comma separated list of post IDs to include in the query (only these content pieces will be included, in the order that they are passed, most other query parameters are ignored if this is set), Conductor_Widget_Default_Query will transform this into an array before passing into WP_Query
      • Default: false
    • post__not_in (string): Comma separated list of post IDs to exclude in the query, Conductor_Widget_Default_Query will transform this into an array before passing into WP_Query
      • Default: false
  • widget_size (string): ID matching the selected registered Conductor Widget display
    • Default: 'large'
  • hide_title (Boolean): Whether or not the widget title (title parameter) is hidden from output
    • Default: false
  • post_thumbnails_size (string): Featured image size used during output if Featured Image output element is visible, if set to false (Boolean) the Conductor Widget will determine the featured image size based on the widget_size value
    • Default: false
  • excerpt_length (int): Length of excerpt displayed, used if content_display_type is set to 'excerpt' and the Content output element is visible
    • Default: apply_filters( 'excerpt_length', 55 ) (55)
  • content_display_type (string): Type of content to be displayed on the front-end ('excerpt' or 'content')
    • Default: 'content'
  • css_class (string): Space separated list of custom CSS classes to be applied to various Conductor Widget HTML elements
    • Default: false
  • output (array): A sortable list of output elements used on the front-end during Conductor Widget output, array key is used as a priority value for the conductor_widget_display_content_{$widget_number} action, can be re-arranged via Conductor Widget Display Settings
    • id (string): Unique ID for an output element
    • label (string): Unique label for an output element
    • type (string): Specified type for an output element ('built-in', 'post_title', 'content', 'read_more', or any custom type)
    • visible (Boolean): Flag to determine whether or not an output element is visible on the front-end
    • link (Boolean) (optional): Flag to determine whether or not an output element is linked (if supported by the callback function) on the front-end
  • output_elements (array): Upon saving of a Conductor Widget, will contain all output element priorities ordered by their ID (id => priority), used in Conductor_Widget_Query, Note: This parameter is not to be confused with the output parameter, which contains full output element configuration data - this parameter will only contain a list of output element IDs and their priorities
    • Default: empty array
  • output_features (array): Features that various output element IDs or output element types support, the Conductor Widget will check for an ID match first and then check for a type match
    • id/type (string): A unique output element ID or output element type
      • link (Boolean): Flag to determine whether or not an output element is linked (if supported by the callback function)
      • edit_label (array): Enable label editing for an output element, pass a 'default' parameter with a default label (string)
        • default (string): Default label for output element
      • remove: Enable ability for an element to be removed from list of output elements
      • edit_content_type (Boolean): Special (internal) parameter, allow for the selection between 'content' and 'excerpt', useful for output elements which output post content or similar
  • flexbox (array): Features relating to the Flexbox portion of Conductor Widgets
    • columns (int): Number of columns used during output if a content layout which supports flexbox is selected
      • Default: 1

Technical Details

  • Type: Filter
  • Parameters:
    • $defaults (array): Default Conductor Widget defaults
    • $widget (Conductor_Widget): Conductor_Widget instance
  • Return Value: array

Resources

Examples

The following example adds a custom parameter to Conductor Widget default settings.

The following example adds an output_features configuration for a custom output element type to Conductor Widget default settings. It can be used in conjunction with the output example below.

The following example adds a custom output element to Conductor Widget default settings. It can be used in conjunction with the output_features example above.

The following example adjusts various Conductor Widget default settings.