Title: Custom Post Type Widgets
Author: thingsym
Published: <strong>2015年1月28日</strong>
Last modified: 2024年8月22日

---

プラグインを検索

このプラグインは **WordPress の最新3回のメジャーリリースに対してテストされていま
せん**。もうメンテナンスやサポートがされていないかもしれず、最新バージョンの WordPress
で使用した場合は互換性の問題が発生する可能性があります。

![](https://s.w.org/plugins/geopattern-icon/custom-post-type-widgets.svg)

# Custom Post Type Widgets

 作者: [thingsym](https://profiles.wordpress.org/thingsym/)

[ダウンロード](https://downloads.wordpress.org/plugin/custom-post-type-widgets.1.5.2.zip)

 * [詳細](https://ja.wordpress.org/plugins/custom-post-type-widgets/#description)
 * [レビュー](https://ja.wordpress.org/plugins/custom-post-type-widgets/#reviews)
 *  [インストール](https://ja.wordpress.org/plugins/custom-post-type-widgets/#installation)
 * [開発](https://ja.wordpress.org/plugins/custom-post-type-widgets/#developers)

 [サポート](https://wordpress.org/support/plugin/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

#### 最近のカスタム投稿

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.

#### アーカイブ (カスタム投稿タイプ)

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**

#### カテゴリー (カスタム投稿タイプ)

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.

#### カレンダー (カスタム投稿タイプ)

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).

#### 最近のコメント (カスタム投稿タイプ)

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.

#### タグクラウド (カスタム投稿タイプ)

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](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/](https://wordpress.org/support/plugin/custom-post-type-widgets/)
 * Issues: [https://github.com/thingsym/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](https://github.com/thingsym/custom-post-type-widgets)
 * [Homepage – WordPress Plugin](https://wordpress.org/plugins/custom-post-type-widgets/)
 * [Translate Custom Post Type Widgets into your language.](https://translate.wordpress.org/projects/wp-plugins/custom-post-type-widgets)

You can also contribute by answering issues on the forums.

 * Forum: [https://wordpress.org/support/plugin/custom-post-type-widgets/](https://wordpress.org/support/plugin/custom-post-type-widgets/)
 * Issues: [https://github.com/thingsym/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.

 1. Fork [Custom Post Type Widgets](https://github.com/thingsym/custom-post-type-widgets)
    from GitHub repository
 2. Create a feature branch: git checkout -b my-new-feature
 3. Commit your changes: git commit -am ‘Add some feature’
 4. Push to the branch: git push origin my-new-feature
 5. 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](https://help.github.com/articles/fork-a-repo/) and [pull requests](https://help.github.com/articles/using-pull-requests/)

#### Test Matrix

For operation compatibility between PHP version and WordPress version, see below
[Github Actions](https://github.com/thingsym/custom-post-type-widgets/actions).

## スクリーンショット

 * [[
 * 最近のカスタム投稿
 * [[
 * アーカイブ (カスタム投稿タイプ)
 * [[
 * カテゴリー (カスタム投稿タイプ)
 * [[
 * カレンダー (カスタム投稿タイプ)
 * [[
 * 最近のコメント (カスタム投稿タイプ)
 * [[
 * タグクラウド (カスタム投稿タイプ)
 * [[
 * Search (Custom Post Type)

## インストール

 1. Download and unzip files. Or install Custom Post Type Widgets plugin using the 
    WordPress plugin installer. In that case, skip 2.
 2. Upload “custom-post-type-widgets” to the “/wp-content/plugins/” directory.
 3. 「プラグイン」メニューからプラグインを有効化します。
 4. Adds widgets to a widget area and configure settings through the ‘Widgets’ menu
    in WordPress.
 5. ではお楽しみください !

**IMPORTANT**: By default, WordPress will not work Date-based permalinks of custom
post type. Recommend that you install the plugin in order to edit the permalink,
if you are using a Date-based permalinks.

And try the following: [Custom Post Type Rewrite](https://wordpress.org/plugins/custom-post-type-rewrite/)

## FAQ

### 404 error when clicking month link.

You may need to edit the permalink of custom post type.

By default, WordPress will not work Date-based permalinks of custom post type.

For example, a month link generates a link in a format like `/<custom post type 
name>/date/YYYY/MM/`, if you set `Numeric` in Common Settings in Permalink Settings.

日付の月のパーマリンクは共通設定により以下の2パターンがあります。
 ただし、以下の
ようなリンクは動きません。

 * `/<custom post type name>/YYYY/MM/` (Day and name, Month and name, Post name)
 * `/<custom post type name>/date/YYYY/MM/` (Numeric)

もしウィジェットで日付をもとにしたパーマリンクを使っている場合、パーマリンクを編集
するためにプラウグインをインストールすることをお勧めします。

それから、次のことも試してみてください。

Custom Post Type Rewrite
 [https://wordpress.org/plugins/custom-post-type-rewrite/](https://wordpress.org/plugins/custom-post-type-rewrite/)

もしパーマリンクを編集するプラグインを複数インストールしていた場合、リライトルール
やパーマリンクが干渉することがあります。

In that case, you can disable the generation of permalinks by setting the following
two constants in wp-config.php or the theme’s function.php.

 * `CUSTOM_POST_TYPE_WIDGETS_DISABLE_LINKS_ARCHIVE`
 * `CUSTOM_POST_TYPE_WIDGETS_DISABLE_LINKS_CALENDAR`
 * define( ‘CUSTOM_POST_TYPE_WIDGETS_DISABLE_LINKS_ARCHIVE’, true );
    define( ‘CUSTOM_POST_TYPE_WIDGETS_DISABLE_LINKS_CALENDAR’,
   true );

### Taxonomy select of Categories or Tags do not appear.

Check the setting of the **hierarchical** argument of the register_taxonomy function.

> hierarchical
>  (boolean) (optional) Is this taxonomy hierarchical (have descendants)
> like categories or not hierarchical like tags. Default: false

Reference: [https://codex.wordpress.org/Function_Reference/register_taxonomy](https://codex.wordpress.org/Function_Reference/register_taxonomy)

By hierarchical option,

If false, use “Tag Cloud (Custom Post Type)” as tags.
 If true, use “Categories (
Custom Post Type)” as categories.

### Search filter dose not work.

Check the setting of the **exclude_from_search** argument of the register_post_type
function.

> ‘exclude_from_search’
>  (bool) Whether to exclude posts with this post type from
> front end search results. Default is the opposite value of $public.

### Show featured image as a thumbnail.

サムネイルを追加するアクションフック
 `custom_post_type_widgets/recent_posts/widget/
prepend`

以下はコードのサンプルです。

    ```
    function cptw_hooks_setup() {
      add_action( 'custom_post_type_widgets/recent_posts/widget/prepend', 'cptw_recent_posts_prepend', 10, 4 );
    }
    add_action( 'after_setup_theme', 'cptw_hooks_setup' );

    function cptw_recent_posts_prepend( $widget_id, $posttype, $instance, $recent_post ) {
      if ( has_post_thumbnail( $recent_post ) ) {
        echo get_the_post_thumbnail( $recent_post );
      }
    }
    ```

Insert the above code into functions.php in your theme.

### Does Custom Post Type Widgets have hooks ?

Custom Post Type Widgets has its own hooks.

Filter hooks

 * custom_post_type_widgets/archive/widget_archives_dropdown_args
 * custom_post_type_widgets/archive/widget_archives_args
 * custom_post_type_widgets/categories/widget_categories_dropdown_args
 * custom_post_type_widgets/categories/widget_categories_args
 * custom_post_type_widgets/recent_comments/widget_comments_args
 * custom_post_type_widgets/recent_posts/widget_posts_args
 * custom_post_type_widgets/search/filter_post_type
 * custom_post_type_widgets/tag_cloud/widget_tag_cloud_args
 * custom_post_type_widgets/calendar/get_custom_post_type_calendar
 * custom_post_type_widgets/archive/get_year_link_custom_post_type
 * custom_post_type_widgets/archive/get_day_link_custom_post_type
 * custom_post_type_widgets/archive/get_month_link_custom_post_type
 * custom_post_type_widgets/archive/trim_post_type
 * custom_post_type_widgets/calendar/get_day_link_custom_post_type
 * custom_post_type_widgets/calendar/get_month_link_custom_post_type

Action hooks

 * custom_post_type_widgets/recent_posts/widget/before
 * custom_post_type_widgets/recent_posts/widget/prepend
 * custom_post_type_widgets/recent_posts/widget/append
 * custom_post_type_widgets/recent_posts/widget/after

Reference: [https://github.com/thingsym/custom-post-type-widgets#hooks](https://github.com/thingsym/custom-post-type-widgets#hooks)

## 評価

![](https://secure.gravatar.com/avatar/38703104c04e81a7f358f0fa67a66231dcd75b25075d717f5b3b2596d0e21b4e?
s=60&d=retro&r=g)

### 󠀁[Excelente!](https://wordpress.org/support/topic/excelente-3993/)󠁿

 [Sergioot](https://profiles.wordpress.org/sergioot/) 2024年7月11日

Está bien el plugin y funciona bien añadiéndolo como Widget, pero no aparece en 
los Bloques de Gutemberg. The plugin is fine and works well adding it as a Widget,
but it does not appear in the Gutenberg Blocks.

![](https://secure.gravatar.com/avatar/33a9c563f0c942a7d8d85b6f7c19fb10ef0500a1ed39e83ace8889af2a9c8ef4?
s=60&d=retro&r=g)

### 󠀁[Great plugin!](https://wordpress.org/support/topic/great-plugin-38039/)󠁿

 [yunysia](https://profiles.wordpress.org/yunysia/) 2023年11月29日

It saved me lots of time!

![](https://secure.gravatar.com/avatar/0771f018c5c481aecb62b5789070e663f32e747831b01c657b7246e43dc9ed21?
s=60&d=retro&r=g)

### 󠀁[Insdipensable](https://wordpress.org/support/topic/insdipensable-6/)󠁿

 [dmsr](https://profiles.wordpress.org/dmsr/) 2022年7月22日

Gagnez du temps! Très utile et fort efficace!

![](https://secure.gravatar.com/avatar/9c7be41168a828b3275c2a320c1b629708f7a7af499541029a40e662b9320a3e?
s=60&d=retro&r=g)

### 󠀁[Gorgeous Content Plugin](https://wordpress.org/support/topic/gorgeous-content-plugin/)󠁿

 [metaeditor](https://profiles.wordpress.org/metaeditor/) 2021年2月3日

Was really surprised how rich this Widget Plugin works. I used it to showcase FAQ
custom posts below on the related Page as Content. Fits perfect. Just tiny adapten
in the Themplate to fit my Theme. Even multiple widgets work on the page. Little
suggestion -if we could add some css class to the Read More Link on the widget -
Select Tag H1,H2, H3 … for the title it would make it even better Thanks a Lot

![](https://secure.gravatar.com/avatar/a7c2e94bd2546e181106110af81621d99186416d59b6cbee43bd1fce319a68f5?
s=60&d=retro&r=g)

### 󠀁[Excellent](https://wordpress.org/support/topic/excellent-8884/)󠁿

 [fev1967](https://profiles.wordpress.org/fev1967/) 2020年4月5日

Works perfectly. All I wanted was to list posts from my custom post type in a widget.
In the same way that regular posts are listed by default. This plugin does the job.
An earlier review says this does not work with the CPT UI plugin. That is not the
case, my custom post type was made with CPT UI and it worked fine.

![](https://secure.gravatar.com/avatar/7de71e907ae74be0fc445702072ec78b5de87138111051c7bf09f6b383f66bb7?
s=60&d=retro&r=g)

### 󠀁[Does not work with CPT UI Plugin](https://wordpress.org/support/topic/does-not-work-with-cpt-ui-plugin/)󠁿

 [benjammin](https://profiles.wordpress.org/benjino/) 2018年10月26日

This is not working with Custom Post Type UI plugin. The categories and archive 
will show in the widget for the CPT, but when you select one from the widget dropdown
it apparently doesn’t filter the post or archives, it will just refresh the page
as if it’s working but the page stays the same.

 [ 14件のレビューをすべて表示 ](https://wordpress.org/support/plugin/custom-post-type-widgets/reviews/)

## 貢献者と開発者

Custom Post Type Widgets はオープンソースソフトウェアです。以下の人々がこのプラグ
インに貢献しています。

貢献者

 *   [ thingsym ](https://profiles.wordpress.org/thingsym/)

“Custom Post Type Widgets” は3ロケールに翻訳されています。 [翻訳者](https://translate.wordpress.org/projects/wp-plugins/custom-post-type-widgets/contributors)
のみなさん、翻訳へのご協力ありがとうございます。

[“Custom Post Type Widgets” をあなたの言語に翻訳しましょう。](https://translate.wordpress.org/projects/wp-plugins/custom-post-type-widgets)

### 開発に興味がありますか ?

[コードを閲覧](https://plugins.trac.wordpress.org/browser/custom-post-type-widgets/)
するか、[SVN リポジトリ](https://plugins.svn.wordpress.org/custom-post-type-widgets/)
をチェックするか、[開発ログ](https://plugins.trac.wordpress.org/log/custom-post-type-widgets/)
を [RSS](https://plugins.trac.wordpress.org/log/custom-post-type-widgets/?limit=100&mode=stop_on_copy&format=rss)
で購読してみてください。

## 変更履歴

#### 1.5.2

 * update japanese translation
 * tested up to 6.2.0
 * fix composer scripts
 * update github actions
 * fix load_textdomain method for testability
 * add msgmerge to composer scripts
 * add support section and enhance contribution section to README
 * fix license
 * update screenshots

#### 1.5.1

 * edit README
 * fix the priority of the rewrite rule of register_post_type()

#### 1.5.0

 * tested up to 6.0.0
 * fix wp-plugin-unit-test.yml
 * update japanese translation
 * update pot
 * fix test case
 * add format argument
 * supports translation
 * add ASC/DESC order option for archive widget
 * add constants CUSTOM_POST_TYPE_WIDGETS_DISABLE_LINKS_ARCHIVE and CUSTOM_POST_TYPE_WIDGETS_DISABLE_LINKS_CALENDAR
 * fix rewrite slug for has_archive setting
 * rename variable name

#### 1.4.2

 * add composer script
 * remove makepot:php composer script
 * change action hook
 * rename method name
 * fix hook to load_textdomain for translate on Widgets Screen
 * replace assert from assertEquals to assertSame

#### 1.4.1

 * add test case
 * fix README
 * update wp-plugin-unit-test.yml
 * bump up yoast/phpunit-polyfills version
 * change os to ubuntu-20.04 for ci
 * add Upgrade Notice
 * change requires at least to wordpress 4.9
 * change requires to PHP 5.6
 * fix: fix pot and translation
 * fix label
 * fix test unit configuration and lint ruleset
 * update composer.json
 * add timeout-minutes to workflows
 * add phpunit-polyfills
 * update install-wp-tests.sh
 * fix .editorconfig
 * tested up to 5.8.0
 * fix github workflows

#### 1.4.0

 * update screenshot
 * tested up to 5.6.2
 * update japanese translation
 * update pot
 * add init method, change method name
 * separate class into separate a file
 * add sponsor link
 * add dropdown label option with categories widget
 * add archive type option with archive widget
 * add donate link
 * add filter hooks, custom_post_type_widgets/archive/get_month_link_custom_post_type,
   custom_post_type_widgets/archive/trim_post_type, custom_post_type_widgets/calendar/
   get_day_link_custom_post_type, custom_post_type_widgets/calendar/get_month_link_custom_post_type
 * add FUNDING.yml
 * add GitHub actions for CI/CD, remove .travis.yml
 * imporve code with phpcs, phpmd and phpstan

#### 1.3.0

 * edit README
 * update japanese translation
 * update pot
 * fix test case
 * imporve code with phpcs, phpmd and phpstan
 * update testunit configuration
 * restructure code to perform a single task
 * add denying direct file access
 * divide as load_textdomain function
 * fix composer.json
 * change calendar widget markup
 * add hook custom_post_type_widgets/calendar/get_custom_post_type_calendar
 * fix get_custom_post_type_calendar method
 * change to call method directly instead of via hook in the calendar widget

#### 1.2.1

 * replace from id attribute to calss attribute in the calendar
 * add any matching value as all types

#### 1.2.0

 * change Requires at least version 4.0
 * [Calendar widget] cache the calendar
 * improve filter hooks and action hooks
 * fix test case
 * refactoring
 * add customize_selective_refresh
 * fix phpcs.ruleset.xml
 * replace from strip_tags to wp_strip_all_tags
 * replace from _e to esc_html_e
 * add PHPDoc
 * fix header
 * add reset-wp-tests.sh, uninstall-wp-tests.sh
 * fix indent and reformat with phpcs and phpcbf
 * add composer.json for test
 * add static code analysis config

#### 1.1.3

 * change Requires at least version 3.7
 * fix add_action
 * add sanitize
 * add tests

#### 1.1.2

 * [Categories widget] change value_field of the cat_args from name to slug
 * limit the scope of the filter hook
 * [Search widget] rename the name of the filter hook
 * fix the initial value of the posttype, the archive_name and the taxonomy

#### 1.1.1

 * [Search widget] add apply_filters ‘WP_Custom_Post_Type_Widgets_Search_filter_post_type’
 * improve function ‘query_search_filter_only_post_type’ [Search widget]
 * [Search widget] change to add_action ‘pre_get_posts’ run only on the front-end
   page

#### 1.1.0

 * [Comments widgets, Search widgets] add ‘All’ to posttype option
 * refactoring
 * add Custom Post Type Search widget

#### 1.0.4

 * fix cache key of Custom Post Type Calendar widget
 * support for custom post type slugs
 * add german translation

#### 1.0.3

 * add italian translation

#### 1.0.2

 * fix $cat_args[‘show_option_none’]

#### 1.0.1

 * fix the ‘name’ param of get_terms()

#### 1.0.0

 * プラグインをリリース

## メタ

 *  バージョン **1.5.2**
 *  最終更新日 **2年前**
 *  有効インストール数 **10,000+**
 *  WordPress バージョン ** 4.9またはそれ以降 **
 *  検証済み最新バージョン: **6.6.5**
 *  PHP バージョン ** 5.6またはそれ以降 **
 *  言語
 * [Chinese (Taiwan)](https://tw.wordpress.org/plugins/custom-post-type-widgets/)、
   [English (US)](https://wordpress.org/plugins/custom-post-type-widgets/)、[Spanish (Spain)](https://es.wordpress.org/plugins/custom-post-type-widgets/)、
   [Swedish](https://sv.wordpress.org/plugins/custom-post-type-widgets/).
 *  [プラグインを翻訳](https://translate.wordpress.org/projects/wp-plugins/custom-post-type-widgets)
 * タグ
 * [custom post type](https://ja.wordpress.org/plugins/tags/custom-post-type/)[taxonomy](https://ja.wordpress.org/plugins/tags/taxonomy/)
   [widget](https://ja.wordpress.org/plugins/tags/widget/)[widgets](https://ja.wordpress.org/plugins/tags/widgets/)
 *  [詳細を表示](https://ja.wordpress.org/plugins/custom-post-type-widgets/advanced/)

## 評価

 5つ星中4.8つ星

 *  [  12 5-星レビュー     ](https://wordpress.org/support/plugin/custom-post-type-widgets/reviews/?filter=5)
 *  [  1 4-星レビュー     ](https://wordpress.org/support/plugin/custom-post-type-widgets/reviews/?filter=4)
 *  [  1 3-星レビュー     ](https://wordpress.org/support/plugin/custom-post-type-widgets/reviews/?filter=3)
 *  [  0 2-星レビュー     ](https://wordpress.org/support/plugin/custom-post-type-widgets/reviews/?filter=2)
 *  [  0 1-星レビュー     ](https://wordpress.org/support/plugin/custom-post-type-widgets/reviews/?filter=1)

[Your review](https://wordpress.org/support/plugin/custom-post-type-widgets/reviews/#new-post)

[すべてのレビューを見る](https://wordpress.org/support/plugin/custom-post-type-widgets/reviews/)

## 貢献者

 *   [ thingsym ](https://profiles.wordpress.org/thingsym/)

## サポート

意見や質問がありますか ?

 [サポートフォーラムを表示](https://wordpress.org/support/plugin/custom-post-type-widgets/)

## 寄付

このプラグインが今後も改善できるよう応援しませんか ?

 [ このプラグインに寄付 ](https://github.com/sponsors/thingsym)