infoMore than 5 years have passed since last update.
【備忘録】wordpressの振り分け関数あれこれ
Last updated at Posted at 2016-06-24
top判定
特定固定ページをトップ(フロントページ)にしてる時
if (is_front_page()) {
///
}
一覧判定
if (is_archive()) {
///
}
カテゴリ一覧判定
if (is_category()) {// 引数にカテゴリスラッグでカテゴリ指定
///
}
記事詳細判定
固定ページ判定
if (is_page()) { // 引数にスラッグで個別判定
///
}
カスタム投稿記事一覧判定
if (is_post_type_archive('カスタム投稿スラッグ')) {// arrayで複数可
///
}
カスタム投稿記事詳細判定
if (is_singular('カスタム投稿スラッグ')) {
///
}
タグ判定
タクソノミ判定
if (is_tax('タームスラッグ')) {
///
}
年別一覧判定
月別一覧判定
検索一覧判定
404判定
管理画面判定
Register as a new user and use Qiita more conveniently
- You get articles that match your needs
- You can efficiently read back useful information
- You can use dark theme
What you can do with signing up