Text Modules

Text Modules

Wordpress plugin

Install on Wordpress

App Details

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.'; } ); 

text_modules_post_type_labels

In case you don’t like the labels, easily adapt them to your liking.

/** * Filter the post type labels. * * @param array $labels Post type labels. */ add_filter( 'text_modules_post_type_labels', function( $labels ) { // A little more horror, please... $labels[ 'not_found' ] = 'ZOMG, no text module found!!1!!1!!oneone!!!1!eleven!1!'; return $labels; } ); 

text_modules_post_type_supports

This filter provides you with the post type supports.

/** * Filter the post type supports. * * @param array $supports Post type supports. */ add_filter( 'text_modules_post_type_supports', function( $supports ) { // Let's add revisions for our post type if ( ! in_array( 'revisions', $supports ) ) { $supports[] = 'revisions'; } return $supports; } ); 

text_modules_shortcode_apply_do_shortcode

By default, do_shortcode() will be called on the shortcode output. Of course, you can change that.

/** * Filter if the shortcode should apply do_shortcode() to the output. * * @param bool $do_shortcode Should the shortcode apply do_shortcode()? */ add_filter( 'text_modules_shortcode_apply_do_shortcode', '__return_false' ); 

text_modules_shortcode_callback

In case you would like to adapt how the shortcode data is handled, you can provide your own shortcode callback. This can either be a string holding the function name, or an array with either a class name or an object, and the according method.

/** * Filter the shortcode callback. * * @param array|string $callback Shortcode callback. */ add_filter( 'text_modules_shortcode_callback', function() { return 'my_text_modules_shortcode_callback'; } ); 

text_modules_shortcode_id_attribute_name

This filter lets you alter the shortcode’s ‘id’ attribute name.

/** * Filter the 'id' shortcode attribute name. * * @param string $name Attribute name. */ add_filter( 'text_modules_shortcode_id_attribute_name', function() { return 'post_id'; } ); 

text_modules_shortcode_output

This filter lets you alter the shortcode output. The second parameter holds the shortcode attributes array.

/** * Filter the shortcode output. * * @param string $output Shortcode output. * @param array $atts Shortcode attributes array. */ add_filter( 'text_modules_shortcode_output', function( $output ) { return $output . ' Over and out.'; } ); 

text_modules_shortcode_query_args

Also, there’s text_modules_shortcode_query_args, which provides you with the complete args array for the shortcode’s query.

/** * Filter the shortcode query args. * * @param array $args Shortcode query args. */ add_filter( 'text_modules_shortcode_query_args', function( $args ) { // Exclude some text modules by ID $args[ 'post__not_in' ] = array( 4, 8, 15, 16, 23, 42 ); return $args; } ); 

text_modules_shortcode_slug_attribute_name

This filter lets you alter the shortcode’s ‘slug’ attribute name.

/** * Filter the 'slug' shortcode attribute name. * * @param string $name Attribute name. */ add_filter( 'text_modules_shortcode_slug_attribute_name', function() { return 'post_slug'; } ); 

text_modules_shortcode_tag

This filter lets you alter the shortcode’s tag.

/** * Filter the shortcode tag. * * @param string $shortcode_tag Shortcode tag. */ add_filter( 'text_modules_shortcode_tag', function() { return 'text_block'; } ); 

text_modules_shortcode_use_slug

By default, text modules are being queried by their post ID first. Of course, you can change that and use the post slug instead.

/** * Filter if the shortcode (query) should use the post slug instead of the post ID. * * @param bool $use_slug Use slug instead of ID? */ add_filter( 'text_modules_shortcode_use_slug', '__return_true' ); 

text_modules_widget_form_query_args

Also, there’s text_modules_widget_form_query_args, which provides you with the complete args array for the widget form’s query.

/** * Filter the widget form query args. * * @param array $args Query args. */ add_filter( 'text_modules_widget_form_query_args', function( $args ) { // Exclude some text modules by ID $args[ 'post__not_in' ] = array( 4, 8, 15, 16, 23, 42 ); return $args; } ); 

Contribution

To contribute to this plugin, please see its GitHub repository.

If you have a feature request, or if you have developed the feature already, please feel free to use the Issues and/or Pull Requests section.

Of course, you can also provide me with translations if you would like to use the plugin in another not yet included language.

Pricing

Starting from $0 per month.

Check Out the Music Player Widget

By Common Ninja

Music PlayerTry For Free!

App Info

Rating

Reviewers

1 reviews

Tags

custom post type
module
modules
post
text

Developed By

Thorsten Frommen

Quick & Easy

Find the Best Wordpress plugins for you

Common Ninja has a large selection of powerful Wordpress plugins that are easy to use, fully customizable, mobile-friendly and rich with features — so be sure to check them out!

Testimonial

Testimonial plugins for Wordpress

Galleries

Galleries plugins for Wordpress

SEO

SEO plugins for Wordpress

Contact Form

Contact Form plugins for Wordpress

Forms

Forms plugins for Wordpress

Social Feeds

Social Feeds plugins for Wordpress

Social Sharing

Social Sharing plugins for Wordpress

Events Calendar

Events Calendar plugins for Wordpress

Sliders

Sliders plugins for Wordpress

Analytics

Analytics plugins for Wordpress

Reviews

Reviews plugins for Wordpress

Comments

Comments plugins for Wordpress

Portfolio

Portfolio plugins for Wordpress

Maps

Maps plugins for Wordpress

Security

Security plugins for Wordpress

Translation

Translation plugins for Wordpress

Ads

Ads plugins for Wordpress

Video Player

Video Player plugins for Wordpress

Music Player

Music Player plugins for Wordpress

Backup

Backup plugins for Wordpress

Privacy

Privacy plugins for Wordpress

Optimize

Optimize plugins for Wordpress

Chat

Chat plugins for Wordpress

Countdown

Countdown plugins for Wordpress

Email Marketing

Email Marketing plugins for Wordpress

Tabs

Tabs plugins for Wordpress

Membership

Membership plugins for Wordpress

popup

popup plugins for Wordpress

SiteMap

SiteMap plugins for Wordpress

Payment

Payment plugins for Wordpress

Coming Soon

Coming Soon plugins for Wordpress

Ecommerce

Ecommerce plugins for Wordpress

Customer Support

Customer Support plugins for Wordpress

Inventory

Inventory plugins for Wordpress

Video Player

Video Player plugins for Wordpress

Testimonials

Testimonials plugins for Wordpress

Tabs

Tabs plugins for Wordpress

Social Sharing

Social Sharing plugins for Wordpress

Social Feeds

Social Feeds plugins for Wordpress

Slider

Slider plugins for Wordpress

Reviews

Reviews plugins for Wordpress

Portfolio

Portfolio plugins for Wordpress

Membership

Membership plugins for Wordpress

Forms

Forms plugins for Wordpress

Events Calendar

Events Calendar plugins for Wordpress

Contact

Contact plugins for Wordpress

Comments

Comments plugins for Wordpress

Analytics

Analytics plugins for Wordpress

Common Ninja Apps

Some of the best Common Ninja plugins for Wordpress

Browse our extensive collection of compatible plugins, and easily embed them on any website, blog, online store, e-commerce platform, or site builder.

Music Player for Wordpress logo

Music Player

Add a no-code music player to your site to stream audio, share playlists, and support multiple formats with easy setup.

Agenda for Wordpress logo

Agenda

Add an event agenda to your site to display schedules clearly, helping users understand timing and plan their attendance.

Corner Coupon Pop-up for Wordpress logo

Corner Coupon Pop-up

Add a corner coupon pop-up to highlight discounts, collect emails, and drive user engagement without interrupting browsing.

Appointment Booking for Wordpress logo

Appointment Booking

Manage appointments with an appointment booking widget that lets visitors schedule easily, syncs calendars, sends reminders, and creates a smoother booking experience.

Sticky Video for Wordpress logo

Sticky Video

Use a sticky video that stays visible while users scroll to keep content in view, increase watch time, and boost engagement.

March Madness Bracket Maker for Wordpress logo

March Madness Bracket Maker

Create interactive March Madness brackets where users can make predictions, track tournament progress, and compete with others throughout every round.

Count-Up Clock for Wordpress logo

Count-Up Clock

Track time since important events with a count up clock that displays elapsed days and hours and keeps visitors engaged.

Charts & Graphs for Wordpress logo

Charts & Graphs

Add charts and graphs to your site to present data clearly, help visitors understand insights faster, and support more confident decision making.

Google Maps for Wordpress logo

Google Maps

Show business locations clearly with a Google Maps widget that displays multiple points, detailed info, and customizable styles to help visitors find you easily.

Diagrams for Wordpress logo

Diagrams

Create interactive diagrams with a diagrams widget that lets you build and customize flow charts, improve clarity, and help visitors understand complex ideas easily.

TikTok Feed for Wordpress logo

TikTok Feed

Show your latest TikTok videos in a live feed that keeps content fresh, builds social proof, and keeps visitors engaged.

Tilted Image for Wordpress logo

Tilted Image

Use tilted image effects to rotate visuals, add creative style, and keep visitors engaged with dynamic images on your site.

Discover Apps By Platform

Discover the best apps for your website

WordPress
Wix
Shopify
Weebly
Webflow
Joomla
PrestaShop
Shift4Shop
WebsiteX5
MODX
Opencart
NopCommerce

Common Ninja Search Engine

The Common Ninja Search Engine platform helps website builders find the best site widgets, apps, plugins, tools, add-ons, and extensions! Compatible with all major website building platforms - big or small - and updated regularly, our Search Engine tool provides you with the business tools your site needs!

Multiple platforms