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.

text_modules_before_widget_content

This filter lets you alter the HTML before the widget content.

text_modules_post_type

Yes, you can alter the post type (slug).

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.

text_modules_post_type_description

The post type description can be customized by using the text_modules_post_type_description filter.

text_modules_post_type_labels

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

text_modules_post_type_supports

This filter provides you with the post type supports.

text_modules_shortcode_apply_do_shortcode

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

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.

text_modules_shortcode_id_attribute_name

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

text_modules_shortcode_output

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

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.

text_modules_shortcode_slug_attribute_name

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

text_modules_shortcode_tag

This filter lets you alter the shortcode’s tag.

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.

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.

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.

0

评论0

 
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
显示验证码
没有账号?注册  忘记密码?

社交账号快速登录