Description

This filter is used to change the registered Conductor content layouts. This filter is used to register Conductor content layouts.

Note: It is expected that registered Conductor content layouts output their own HTML markup and CSS for the content layout preview, though it is not required. See the preview parameter below for available CSS classes.

Conductor ships with 6 content layouts:

  • Default (default – Disables Conductor, not a “true” content layout)
  • 1 Column (cols-1 – Content, Full Width)
  • 2 Columns (cols-2 – Content Left, Primary Sidebar Right)
  • 2 Columns (cols-2-r – Content Right, Primary Sidebar Left)
  • 3 Columns (cols-3 – Content Left, Primary Sidebar Middle, Secondary Sidebar Right)
  • 3 Columns (cols-3-m – Primary Sidebar Left, Content Middle, Secondary Sidebar Right)
  • 3 Columns (cols-3-r – Primary Sidebar Left, Secondary Sidebar Middle, Content Right)

Note: Though there are technically 7 content layouts the listed above, the default content layout is not a “true” content layout. We’ve included it for completeness.

This filter is executed when the Conductor_Options::get_content_layouts() function is called.

Conductor content layout data structure (array keys and values):

Note: At a minimum, Conductor content layout data should include the label and preview keys. Custom data can be added under any parameter that is not listed below.

  • label (string): Label for this content layout, should be unique, not currently used by Conductor
  • preview (string): HTML for preview in Conductor Options and the Customizer, can contain PHP format syntax strings (see preview_values parameter)
    • Conductor content layout preview CSS classes (see examples below):
      • cols (wrapper, designates columns for preview)
      • cols-1 (wrapper, designates one column for preview)
      • cols-2 (wrapper, designates two columns for preview)
      • cols-2-r (wrapper, two columns, reverse)
      • cols-3 (wrapper, designates three columns for preview)
      • cols-3-m (wrapper, three columns, content middle)
      • cols-3-r (wrapper, three columns, reverse)
      • col (column, designates element is a column)
      • col-content (column, content, designates a content column)
      • col-sidebar (column, sidebar, designates a sidebar column)
      • col-sidebar-secondary (column, sidebar, designates a secondary sidebar column)
  • preview_values (array) (optional): Values corresponding with PHP format strings in the preview parameter, number of array keys should match number of format strings, passed to vprintf() upon output
  • template (string) (optional): Name of template file to use for the content layout if it is selected for use on a piece of content, should contain the .php extension (see example below)
  • body_class (string, array) (optional): CSS classes to be applied to the <body> element when this content layout is selected on a piece of content
  • has_sidebars (array) (optional): Conductor Sidebar IDs which this template supports, by default it is expected that Conductor templates support the "content" sidebar
    • Default Conductor Sidebar IDs:
      • primary (Conductor Primary Sidebar)
      • secondary (Conductor Secondary Sidebar)
Conductor content layout data examples:
One column (full width) content layout data:
array(
	'label' => __( 'Full Width', 'conductor' ),
	'preview' => '<div class="cols cols-1">
		<div class="col col-content"> </div>
	</div>'
)
Three column, content middle, content layout data:
array(
	'label' => __( 'Sidebar, Content, Sidebar', 'conductor' ),
	'preview' => '<div class="cols cols-3 cols-3-m">
		<div class="col col-sidebar"> </div>
		<div class="col col-content"> </div>
		<div class="col col-sidebar col-sidebar-secondary"> </div>
	</div>'
)
Custom content layout data:
array(
	'label' => __( 'My Custom Conductor Layout', 'text-domain' ),
	'preview' => '<div class="cols cols-1">
		<div class="col col-content" title="%1$s">
			<span class="label">%1$s</span>
		</div>
	</div>',
	'preview_values' => array( __( 'Custom', 'text-domain' ) ),
	'template' => 'my-custom-template.php',
	'body_class' => 'conductor-my-custom-layout',
	'has_sidebars' => array( 'primary', 'secondary' )
)

Technical Details

  • Type: Filter
  • Parameters:
    • $content_layouts (array): Default Conductor content layouts
  • REturn: array

Resources

Examples

The following example registers custom Conductor content layouts.