Custom Post Type Widgets
Custom Post Type Widgets plugin adds default custom post type widgets. You can filter by registered Custom Post Type or Taxonomy on widgets. Descriptions of Widgets Recent Posts (Custom Post Type) display a list of the most recent custom posts. Title – description that appears over the list of recent custom posts. Post Type – if selected, filter by a custom post type. (e.g. post). Number of posts to show (at most 15) – enter the number of posts to display. Display post date? – if checked, display post date. Archives (Custom Post Type) display a list of archive links for each month that has custom posts. Title – description that appears over the list of archive links. Post Type – if selected, filter by a custom post type. (e.g. post). Archive Type Display as dropdown – if checked, this box causes the archives to be displayed in a drop-down box. Show post counts – if checked, this box causes a count of the number of posts for each archive period. Order Categories (Custom Post Type) display a list of categories that has custom posts. Title – description that appears over the list of categories. Taxonomy – if selected, filter a custom taxonomy (e.g. category). Display as dropdown – if checked, this box causes the categories to be displayed in a dropdown box. Show post counts – if checked, this box causes the count of the number of posts to display with each category. Show hierarchy – if checked, shows parent/child relationships in an indented manner. Calendar (Custom Post Type) display a calendar of the current month. Title – description that appears over the calendar. Post Type – if selected, filter by a custom post type. (e.g. post). Recent Comments (Custom Post Type) display a list of the most recent comments. Title – description that appears over the list of recent comments. Post Type – if selected, filter by a custom post type. (e.g. post). Number of comments to show (at most 15) – enter the number of comments to be displayed. Tag Cloud (Custom Post Type) display a list of the top 45 that has used in a tag cloud. Title – description that appears over the tag cloud. Taxonomy – if selected, filter a custom taxonomy (e.g. post_tag). Show tag counts – if checked, this box causes the count of the number of tags to display with each tag. Search (Custom Post Type) A search form for your site. Title – description that appears over the search. Post Type – if selected, filter by a custom post type. (e.g. post). Hooks Custom Post Type Widgets has its own hooks. See the reference for details. Reference: https://github.com/thingsym/custom-post-type-widgets#hooks Support If you have any trouble, you can use the forums or report bugs. Forum: https://wordpress.org/support/plugin/custom-post-type-widgets/ Issues: https://github.com/thingsym/custom-post-type-widgets/issues Contribution Small patches and bug reports can be submitted a issue tracker in Github. Forking on Github is another good way. You can send a pull request. Translating a plugin takes a lot of time, effort, and patience. I really appreciate the hard work from these contributors. If you have created or updated your own language pack, you can send gettext PO and MO files to author. I can bundle it into plugin. VCS – GitHub Homepage – WordPress Plugin Translate Custom Post Type Widgets into your language. You can also contribute by answering issues on the forums. Forum: https://wordpress.org/support/plugin/custom-post-type-widgets/ Issues: https://github.com/thingsym/custom-post-type-widgets/issues Patches and Bug Fixes Forking on Github is another good way. You can send a pull request. Fork Custom Post Type Widgets from GitHub repository Create a feature branch: git checkout -b my-new-feature Commit your changes: git commit -am ‘Add some feature’ Push to the branch: git push origin my-new-feature Create new Pull Request Contribute guidlines If you would like to contribute, here are some notes and guidlines. All development happens on the develop branch, so it is always the most up-to-date The master branch only contains tagged releases If you are going to be submitting a pull request, please submit your pull request to the develop branch See about forking and pull requests Test Matrix For operation compatibility between PHP version and WordPress version, see below Github Actions.
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 ' '; } ); 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 ' '; } ); 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.