Filter Hooks - miya0001/content-template-engine GitHub Wiki

content_template_engine_twig_options

Filters the Twig options.

add_filter( 'content_template_engine_twig_options', function( $options ){
    $options['cache'] = '/path/to/cache';
    return $options;
} );

See also documentation.

content_template_engine_twig_extensions

Filters the twig extension objects.

add_filter( 'content_template_engine_twig_options', function( $extensions ){
    $extensions[] = new Your_Custom_Extension();
    return $extensions;
} );

See also documentation.

content_template_engine_variables

Filters the variables for template.

add_filter( 'content_template_engine_variables', function( $variables ){
    $variables['items'] = get_posts( array( ... ) );
    return $variables;
} );

content_template_engine_content

Filters the template before render.

add_filter( 'content_template_engine_content', function( $content ){
    $content = do_something( $content );
    return $content;
} );

content_template_engine_widget_variables

Filters the variables for template in the text widget.

add_filter( 'content_template_engine_widget_variables', function( $variables ){
    $variables['items'] = get_posts( array( ... ) );
    return $variables;
} );

content_template_engine_widget_content

Filters the template before render in the text widget.

add_filter( 'content_template_engine_widget_content', function( $content ){
    $content = do_something( $content );
    return $content;
} );

content_template_engine_allowed_post_types

Filters the post types that is enabled template system. Defaults are post and page. You can enable template engine in your custom post type.

add_filter( 'content_template_engine_allowed_post_types', function( $post_types ){
    $post_types[] = 'my_custom_post_type';
    return $post_types;
} );

content_template_engine_capability

Filters the role or capability who can enables template.

add_filter( 'content_template_engine_capability', function( $role ){
    $role = 'editor'; // Default is administrator
    return $role;
} );