Text Modules
Use the new Text Modules custom post type and display a text module by either shortcode or widget. Have you ever wanted to use some pieces of text information more than once? For instance, contact information such as a postal address? Or some slogan, motto or claim? This is exactly when Text Modules
Use the new Text Modules custom post type and display a text module by either shortcode or widget.
Have you ever wanted to use some pieces of text information more than once? For instance, contact information such as a postal address? Or some slogan, motto or claim?
This is exactly when Text Modules kicks in.
Usage
This plugin registers a simple post type for text modules. A text module can be accessed either via shortcode (by means of the text module’s ID or slug) or via a new Tex Modules widget.
Filters
In order to customize certain aspects of the plugin, it provides you with several filters. For each of these, a short description as well as a code example on how to alter the default behavior is given below. Just put the according code snippet in your theme’s functions.php file or your customization plugin, or to some other appropriate place.
text_modules_after_widget_content
This filter lets you alter the HTML after the widget content.
/** * Filter the HTML after the widget content. * * @param string $after_widget_content Some HTML after the widget content. */ add_filter( 'text_modules_after_widget_content', function() { return '<!-- End of Text Modules widget content -->'; } );
text_modules_before_widget_content
This filter lets you alter the HTML before the widget content.
/** * Filter the HTML before the widget content. * * @param string $before_widget_content Some HTML before the widget content. */ add_filter( 'text_modules_before_widget_content', function() { return '<!-- Start of Text Modules widget content -->'; } );
text_modules_post_type
Yes, you can alter the post type (slug).
/** * Filter the post type. * * @param string $post_type Post type. */ add_filter( 'text_modules_post_type', function() { return 'exotic_stuff'; } );
text_modules_post_type_args
If you want to alter a specific post type argument but you can’t find a fitting filter, there’s text_modules_post_type_args , which provides you with the complete args array.
/** * Filter the post type args. * * @param array $args Post type args. */ add_filter( 'text_modules_post_type_args', function( $args ) { // Use hierarchical external content $args[ 'hierarchical' ] = TRUE; return $args; } );
text_modules_post_type_description
The post type description can be customized by using the text_modules_post_type_description filter.
/** * Filter the post type description. * * @param string $description Post type description. */ add_filter( 'text_modules_post_type_description', function() { // Provide a description return 'Simple post type for text modules.'; } );