Skip to content

Available Filters

Aaron Ware edited this page Sep 1, 2016 · 7 revisions

mesh_content_css

Add your own custom CSS to tinymce editor for columns/blocks. Keep in mind that if you are loading in an external responsive grid framework into the tinymce editor that it can sometimes have funky effects.

apply_filters( 'mesh_content_css', get_stylesheet_directory_uri() . '/css/admin-editor.css' , 'editor_path' ),

example: enqueue editor css

add_filter( 'mesh_content_css', 'hatch_mesh_content_css' );

function hatch_mesh_content_css( $editor_path ) {
    // my themes stylesheet
    return get_stylesheet_directory_uri() . '/css/hatch-admin-editor.css';
}

mesh_section_templates

Filter the selectable layout templates within Mesh

apply_filters( 'mesh_section_templates', $section_templates );

example: remove a template

add_filter( 'mesh_section_templates', 'hatch_mesh_section_templates', 10, 1 );

function hatch_mesh_section_templates( $section_templates = array() ) {
    unset( $section_templates[0] ); // remove the first element in our sections array and return

    return $section_templates;
}

mesh_tabs

Add custom tabs to the Mesh settings areas.``

apply_filters( 'mesh_tabs', $tabs );

mesh_css_mode

Allow filtering of available css_mode options.

apply_filters( 'mesh_css_mode', $css_mode );

example: Add a custom option for css framework

If you are familiar with wp_enqueue_style you can simply select "Disable Mesh CSS" and enqueue your own styles to accomplish the same thing.

Please note that this is only part of a larger example. There will be a larger example to enqueue the proper css as well.

/* Defaults
$css_mode = array(
    array( 'label' => __( 'Use Mesh CSS', 'linchpin-mesh' ), 'value' => '' ),
    array( 'label' => __( 'Disable Mesh CSS', 'linchpin-mesh' ), 'value' => 0 ),
    array( 'label' => __( 'Use Foundation w/ my theme', 'linchpin-mesh' ), 'value' => 1 ),
    array( 'label' => __( 'Use Bootstrap (coming soon)', 'linchpin-mesh' ), 'value' => 2 ),
);
*/

add_filter( 'mesh_css_mode', 'hatch_mesh_css_mode', 10, 1 );

function hatch_mesh_css_mode( $css_modes ) {
    $css_modes[] = array( 'label' => __( 'My Custom CSS Framework', 'hatch' ), 'value' => (int) 1000 ),
}

mesh_allowed_html

Allow filtering of the approved html within tinymce.

apply_filters( 'mesh_allowed_html', array_merge_recursive( $post_allowed, $mesh_allowed ); Filter allowed HTML within MCS

mesh_admin_pointers-

Allow filtering of the available help pointers within the WordPress dashboard.

apply_filters( 'mesh_admin_pointers-' . $screen_id, array() );

Added 1.1

Within 1.1 powerful filter was added to disable automatic output of mesh sections after the loop. This is really useful if you have a complex page template and need to separate your sections from "The Loop"

apply_filters( 'mesh_loop_end, $sections );`

add_filter( 'mesh_loop_end', hatch_mesh_loop_end' );

function hatch_mesh_loop_end( $sections ) {
    if( is_home() ) {
        return '';
    } else {
        return $sections;
    }
}

If you want to hide mesh sections from automatically displaying on all pages you can do the following.

add_filter( 'mesh_loop_end', '__return_empty_string' );