# Simple Custom Post Type Archivesがとても便利

- リンク: https://torounit.com/blog/simple-custom-post-type-archives%e3%81%8c%e3%81%a8%e3%81%a6%e3%82%82%e4%be%bf%e5%88%a9/
- 公開日: 2010-10-29T23:03:21+09:00
- 作成者: Toro\_Unit

Simple Custom Post Type Archives

[﻿http://www.cmurrayconsulting.com/software/wordpress-custom-post-type-archives/](http://www.cmurrayconsulting.com/software/wordpress-custom-post-type-archives/)

が、カスタム投稿を使うとき、とても便利です。

機能1

カスタム投稿の記事一覧ページのURLを

http://ブログのアドレス/?post_type=カスタム投稿名　=> http://ブログのアドレス/カスタム
投稿名

に変更してくれます。また、そのときにwp_titleにもカスタム投稿のラベルでセットした
名前が表示されます。

機能2

カスタム投稿の記事一覧ページのテンプレートを設定できます。

 1. type-“カスタム投稿名”.php
 2. type-“スラッグ”.php
 3. type.php
 4. index.php

の順番にテンプレートを探しに行くようです。

機能3

body_classもこんなのを吐いてくれます。

 * custom-post-type-archive
 * custom-post-type-”カスタム投稿名”-archive

地味だけど以外に使えるような気がする。。。
