Action / Filter reference

Layouts

Actions

before_render

Fired just before render.

function cl_layout_before_render( $settings ) {
	// Do something before the render
}

add_action( 'custom-layouts/layout/before_render', 'cl_layout_before_render', 10 );

after_render

Fired just after render.

function cl_layout_after_render( $settings ) {
	// Do something after the render
}

add_action( 'custom-layouts/layout/after_render', 'cl_layout_after_render', 10 );

Filters

render_output

Modify the HTML output from the render method.

function layout_render_output( $output, $settings ) {
	// Modify the output
	$output = 'Before Layout content' . $output . 'After Layout content';
	// Always return in WP filters
	return $output;
}

add_filter( 'custom-layouts/layout/render_output', 'layout_render_output', 10, 2 );

query_args

Modify the query arguments used to generate the posts in the layout.

function layout_query_args( $query_args ) {
	// Modify the query
	$query_args['post_type'] = array( 'post', 'page' );
	// Always return in WP filters
	return $query_args;
}

add_filter( 'custom-layouts/layout/query_args', 'layout_query_args', 10 );

Templates

Actions

function cl_template_before_render( $settings ) {
	// Do something before the render
}

add_action( 'custom-layouts/template/before_render', 'cl_template_before_render', 10 );

after_render

Fired just after render.

function cl_template_after_render( $settings ) {
	// Do something after the render
}

add_action( 'custom-layouts/template/after_render', 'cl_template_after_render', 10 );

Filters

render_output

Modify the HTML output from the render method.

function template_render_output( $output, $settings ) {
	// Modify the output
	$output = 'Before template content' . $output . 'After template content';
	// Always return in WP filters
	return $output;
}

add_filter( 'custom-layouts/template/render_output', 'template_render_output', 10, 2 );

Elements

Actions

function cl_template_before_render( $settings ) {
	// Do something before the render
}

add_action( 'custom-layouts/element/before_render', 'cl_template_before_render', 10 );

after_render

Fired just after render.

function cl_template_after_render( $settings ) {
	// Do something after the render
}

add_action( 'custom-layouts/element/after_render', 'cl_template_after_render', 10 );

Filters

render_output

Modify the HTML output from the render method.

function cl_element_render_output( $output, $element_type  ) {
	// Modify the output
	$output = 'before element content ' . $output . 'After element content';
	// Always return in WP filters
	return $output;
}

add_filter( 'custom-layouts/element/render_output', 'cl_element_render_output', 10, 2 );