{"id":37780,"date":"2015-07-24T12:56:17","date_gmt":"2015-07-24T12:56:17","guid":{"rendered":"https:\/\/wordpress.org\/plugins-wp\/text-modules\/"},"modified":"2015-08-20T00:32:39","modified_gmt":"2015-08-20T00:32:39","slug":"text-modules","status":"publish","type":"plugin","link":"https:\/\/azb.wordpress.org\/plugins\/text-modules\/","author":14599396,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_crdt_document":"","version":"1.0.1","stable_tag":"trunk","tested":"4.3.34","requires":"3.0.0","requires_php":"","requires_plugins":"","header_name":"Text Modules","header_author":"Thorsten Frommen","header_description":"","assets_banners_color":"","last_updated":"2015-08-20 00:32:39","external_support_url":"","external_repository_url":"","donate_link":"http:\/\/ipm-frommen.de\/wordpress","header_plugin_uri":"https:\/\/wordpress.org\/plugins\/text-modules\/","header_author_uri":"http:\/\/ipm-frommen.de\/wordpress","rating":5,"author_block_rating":0,"active_installs":50,"downloads":2359,"num_ratings":1,"support_threads":0,"support_threads_resolved":0,"author_block_count":0,"sections":["description","installation","changelog"],"tags":[],"upgrade_notice":[],"ratings":{"1":0,"2":0,"3":0,"4":0,"5":"1"},"assets_icons":{"icon-128x128.png":{"filename":"icon-128x128.png","revision":"1205728","resolution":"128x128","location":"assets"},"icon-256x256.png":{"filename":"icon-256x256.png","revision":"1205728","resolution":"256x256","location":"assets"}},"assets_banners":[],"assets_blueprints":{},"all_blocks":[],"tagged_versions":[],"block_files":[],"assets_screenshots":{"screenshot-1.png":{"filename":"screenshot-1.png","revision":"1225711","resolution":"1","location":"assets"},"screenshot-2.png":{"filename":"screenshot-2.png","revision":"1225711","resolution":"2","location":"assets"},"screenshot-3.png":{"filename":"screenshot-3.png","revision":"1225711","resolution":"3","location":"assets"}},"screenshots":{"1":"<strong>List table<\/strong> - Here you can see all text modules together with their individual slug and shortcode.","2":"<strong>Meta box<\/strong> - Here you can see the currently edited text module's shortcode.","3":"<strong>Widget<\/strong> - Use any text module in a Text Module widget."},"jetpack_post_was_ever_published":false},"plugin_section":[],"plugin_tags":[1794,5851,10447,86,749],"plugin_category":[],"plugin_contributors":[80310],"plugin_business_model":[],"class_list":["post-37780","plugin","type-plugin","status-publish","hentry","plugin_tags-custom-post-type","plugin_tags-module","plugin_tags-modules","plugin_tags-post","plugin_tags-text","plugin_contributors-ipm-frommen","plugin_committers-tfrommen"],"banners":[],"icons":{"svg":false,"icon":"https:\/\/ps.w.org\/text-modules\/assets\/icon-128x128.png?rev=1205728","icon_2x":"https:\/\/ps.w.org\/text-modules\/assets\/icon-256x256.png?rev=1205728","generated":false},"screenshots":[{"src":"https:\/\/ps.w.org\/text-modules\/assets\/screenshot-1.png?rev=1225711","caption":"<strong>List table<\/strong> - Here you can see all text modules together with their individual slug and shortcode."},{"src":"https:\/\/ps.w.org\/text-modules\/assets\/screenshot-2.png?rev=1225711","caption":"<strong>Meta box<\/strong> - Here you can see the currently edited text module's shortcode."},{"src":"https:\/\/ps.w.org\/text-modules\/assets\/screenshot-3.png?rev=1225711","caption":"<strong>Widget<\/strong> - Use any text module in a Text Module widget."}],"raw_content":"<!--section=description-->\n<p><strong>Use the new Text Modules custom post type and display a text module by either shortcode or widget.<\/strong><\/p>\n\n<p>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?<\/p>\n\n<p>This is exactly when <em>Text Modules<\/em> kicks in.<\/p>\n\n<h4>Usage<\/h4>\n\n<p>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.<\/p>\n\n<p><strong>Filters<\/strong><\/p>\n\n<p>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 <code>functions.php<\/code> file or your <em>customization<\/em> plugin, or to some other appropriate place.<\/p>\n\n<p><strong><code>text_modules_after_widget_content<\/code><\/strong><\/p>\n\n<p>This filter lets you alter the HTML after the widget content.<\/p>\n\n<pre><code>\/**\n * Filter the HTML after the widget content.\n *\n * @param string $after_widget_content Some HTML after the widget content.\n *\/\nadd_filter( 'text_modules_after_widget_content', function() {\n\n    return '&lt;!-- End of Text Modules widget content --&gt;';\n} );\n<\/code><\/pre>\n\n<p><strong><code>text_modules_before_widget_content<\/code><\/strong><\/p>\n\n<p>This filter lets you alter the HTML before the widget content.<\/p>\n\n<pre><code>\/**\n * Filter the HTML before the widget content.\n *\n * @param string $before_widget_content Some HTML before the widget content.\n *\/\nadd_filter( 'text_modules_before_widget_content', function() {\n\n    return '&lt;!-- Start of Text Modules widget content --&gt;';\n} );\n<\/code><\/pre>\n\n<p><strong><code>text_modules_post_type<\/code><\/strong><\/p>\n\n<p>Yes, you can alter the post type (slug).<\/p>\n\n<pre><code>\/**\n * Filter the post type.\n *\n * @param string $post_type Post type.\n *\/\nadd_filter( 'text_modules_post_type', function() {\n\n    return 'exotic_stuff';\n} );\n<\/code><\/pre>\n\n<p><strong><code>text_modules_post_type_args<\/code><\/strong><\/p>\n\n<p>If you want to alter a specific post type argument but you can't find a fitting filter, there's <code>text_modules_post_type_args<\/code>, which provides you with the complete args array.<\/p>\n\n<pre><code>\/**\n * Filter the post type args.\n *\n * @param array $args Post type args.\n *\/\nadd_filter( 'text_modules_post_type_args', function( $args ) {\n\n    \/\/ Use hierarchical external content\n    $args[ 'hierarchical' ] = TRUE;\n\n    return $args;\n} );\n<\/code><\/pre>\n\n<p><strong><code>text_modules_post_type_description<\/code><\/strong><\/p>\n\n<p>The post type description can be customized by using the <code>text_modules_post_type_description<\/code> filter.<\/p>\n\n<pre><code>\/**\n * Filter the post type description.\n *\n * @param string $description Post type description.\n *\/\nadd_filter( 'text_modules_post_type_description', function() {\n\n    \/\/ Provide a description\n    return 'Simple post type for text modules.';\n} );\n<\/code><\/pre>\n\n<p><strong><code>text_modules_post_type_labels<\/code><\/strong><\/p>\n\n<p>In case you don't like the labels, easily adapt them to your liking.<\/p>\n\n<pre><code>\/**\n * Filter the post type labels.\n *\n * @param array $labels Post type labels.\n *\/\nadd_filter( 'text_modules_post_type_labels', function( $labels ) {\n\n    \/\/ A little more horror, please...\n    $labels[ 'not_found' ] = 'ZOMG, no text module found!!1!!1!!oneone!!!1!eleven!1!';\n\n    return $labels;\n} );\n<\/code><\/pre>\n\n<p><strong><code>text_modules_post_type_supports<\/code><\/strong><\/p>\n\n<p>This filter provides you with the post type supports.<\/p>\n\n<pre><code>\/**\n * Filter the post type supports.\n *\n * @param array $supports Post type supports.\n *\/\nadd_filter( 'text_modules_post_type_supports', function( $supports ) {\n\n    \/\/ Let's add revisions for our post type\n    if ( ! in_array( 'revisions', $supports ) ) {\n        $supports[] = 'revisions';\n    }\n\n    return $supports;\n} );\n<\/code><\/pre>\n\n<p><strong><code>text_modules_shortcode_apply_do_shortcode<\/code><\/strong><\/p>\n\n<p>By default, do_shortcode() will be called on the shortcode output. Of course, you can change that.<\/p>\n\n<pre><code>\/**\n * Filter if the shortcode should apply do_shortcode() to the output.\n *\n * @param bool $do_shortcode Should the shortcode apply do_shortcode()?\n *\/\nadd_filter( 'text_modules_shortcode_apply_do_shortcode', '__return_false' );\n<\/code><\/pre>\n\n<p><strong><code>text_modules_shortcode_callback<\/code><\/strong><\/p>\n\n<p>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.<\/p>\n\n<pre><code>\/**\n * Filter the shortcode callback.\n *\n * @param array|string $callback Shortcode callback.\n *\/\nadd_filter( 'text_modules_shortcode_callback', function() {\n\n    return 'my_text_modules_shortcode_callback';\n} );\n<\/code><\/pre>\n\n<p><strong><code>text_modules_shortcode_id_attribute_name<\/code><\/strong><\/p>\n\n<p>This filter lets you alter the shortcode's 'id' attribute name.<\/p>\n\n<pre><code>\/**\n * Filter the 'id' shortcode attribute name.\n *\n * @param string $name Attribute name.\n *\/\nadd_filter( 'text_modules_shortcode_id_attribute_name', function() {\n\n    return 'post_id';\n} );\n<\/code><\/pre>\n\n<p><strong><code>text_modules_shortcode_output<\/code><\/strong><\/p>\n\n<p>This filter lets you alter the shortcode output. The second parameter holds the shortcode attributes array.<\/p>\n\n<pre><code>\/**\n * Filter the shortcode output.\n *\n * @param string $output Shortcode output.\n * @param array  $atts   Shortcode attributes array.\n *\/\nadd_filter( 'text_modules_shortcode_output', function( $output ) {\n\n    return $output . ' Over and out.';\n} );\n<\/code><\/pre>\n\n<p><strong><code>text_modules_shortcode_query_args<\/code><\/strong><\/p>\n\n<p>Also, there's <code>text_modules_shortcode_query_args<\/code>, which provides you with the complete args array for the shortcode's query.<\/p>\n\n<pre><code>\/**\n * Filter the shortcode query args.\n *\n * @param array $args Shortcode query args.\n *\/\nadd_filter( 'text_modules_shortcode_query_args', function( $args ) {\n\n    \/\/ Exclude some text modules by ID\n    $args[ 'post__not_in' ] = array( 4, 8, 15, 16, 23, 42 );\n\n    return $args;\n} );\n<\/code><\/pre>\n\n<p><strong><code>text_modules_shortcode_slug_attribute_name<\/code><\/strong><\/p>\n\n<p>This filter lets you alter the shortcode's 'slug' attribute name.<\/p>\n\n<pre><code>\/**\n * Filter the 'slug' shortcode attribute name.\n *\n * @param string $name Attribute name.\n *\/\nadd_filter( 'text_modules_shortcode_slug_attribute_name', function() {\n\n    return 'post_slug';\n} );\n<\/code><\/pre>\n\n<p><strong><code>text_modules_shortcode_tag<\/code><\/strong><\/p>\n\n<p>This filter lets you alter the shortcode's tag.<\/p>\n\n<pre><code>\/**\n * Filter the shortcode tag.\n *\n * @param string $shortcode_tag Shortcode tag.\n *\/\nadd_filter( 'text_modules_shortcode_tag', function() {\n\n    return 'text_block';\n} );\n<\/code><\/pre>\n\n<p><strong><code>text_modules_shortcode_use_slug<\/code><\/strong><\/p>\n\n<p>By default, text modules are being queried by their post ID first. Of course, you can change that and use the post slug instead.<\/p>\n\n<pre><code>\/**\n * Filter if the shortcode (query) should use the post slug instead of the post ID.\n *\n * @param bool $use_slug Use slug instead of ID?\n *\/\nadd_filter( 'text_modules_shortcode_use_slug', '__return_true' );\n<\/code><\/pre>\n\n<p><strong><code>text_modules_widget_form_query_args<\/code><\/strong><\/p>\n\n<p>Also, there's <code>text_modules_widget_form_query_args<\/code>, which provides you with the complete args array for the widget form's query.<\/p>\n\n<pre><code>\/**\n * Filter the widget form query args.\n *\n * @param array $args Query args.\n *\/\nadd_filter( 'text_modules_widget_form_query_args', function( $args ) {\n\n    \/\/ Exclude some text modules by ID\n    $args[ 'post__not_in' ] = array( 4, 8, 15, 16, 23, 42 );\n\n    return $args;\n} );\n<\/code><\/pre>\n\n<h4>Contribution<\/h4>\n\n<p>To <strong>contribute<\/strong> to this plugin, please see its <a href=\"https:\/\/github.com\/tfrommen\/text-modules\"><strong>GitHub repository<\/strong><\/a>.<\/p>\n\n<p>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.<\/p>\n\n<p>Of course, you can also provide me with translations if you would like to use the plugin in another not yet included language.<\/p>\n\n<!--section=installation-->\n<p>This plugin requires PHP 5.3.<\/p>\n\n<ol>\n<li>Upload the <code>text-modules<\/code> folder to the <code>\/wp-content\/plugins\/<\/code> directory on your web server.<\/li>\n<li>Activate the plugin through the <em>Plugins<\/em> menu in WordPress.<\/li>\n<li>Find the new <em>Text Modules<\/em> menu in your WordPress backend.<\/li>\n<\/ol>\n\n<!--section=changelog-->\n<h4>1.0.1<\/h4>\n\n<ul>\n<li>Escape translated strings.<\/li>\n<li>Improve namespace imports.<\/li>\n<li>Compatible up to WordPress 4.2.4.<\/li>\n<\/ul>\n\n<h4>1.0.0<\/h4>\n\n<ul>\n<li>Initial release.<\/li>\n<li>wordpress.org release.<\/li>\n<li>Compatible up to WordPress 4.2.3.<\/li>\n<\/ul>","raw_excerpt":"Use the new Text Modules custom post type and display a text module by either shortcode or widget.","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/azb.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin\/37780","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/azb.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin"}],"about":[{"href":"https:\/\/azb.wordpress.org\/plugins\/wp-json\/wp\/v2\/types\/plugin"}],"replies":[{"embeddable":true,"href":"https:\/\/azb.wordpress.org\/plugins\/wp-json\/wp\/v2\/comments?post=37780"}],"author":[{"embeddable":true,"href":"https:\/\/azb.wordpress.org\/plugins\/wp-json\/wporg\/v1\/users\/tfrommen"}],"wp:attachment":[{"href":"https:\/\/azb.wordpress.org\/plugins\/wp-json\/wp\/v2\/media?parent=37780"}],"wp:term":[{"taxonomy":"plugin_section","embeddable":true,"href":"https:\/\/azb.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_section?post=37780"},{"taxonomy":"plugin_tags","embeddable":true,"href":"https:\/\/azb.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_tags?post=37780"},{"taxonomy":"plugin_category","embeddable":true,"href":"https:\/\/azb.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_category?post=37780"},{"taxonomy":"plugin_contributors","embeddable":true,"href":"https:\/\/azb.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_contributors?post=37780"},{"taxonomy":"plugin_business_model","embeddable":true,"href":"https:\/\/azb.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_business_model?post=37780"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}