LoginSignup
4
4

More than 5 years have passed since last update.

【備忘録】wordpressの振り分け関数あれこれ

Last updated at Posted at 2016-06-24

top判定

if (is_home()) {
///
}

特定固定ページをトップ(フロントページ)にしてる時

if (is_front_page()) {
///
}

一覧判定

if (is_archive()) {
///
}

カテゴリ一覧判定

if (is_category()) {// 引数にカテゴリスラッグでカテゴリ指定
///
}

記事詳細判定

if (is_single()) {
///
}

固定ページ判定

if (is_page()) { // 引数にスラッグで個別判定
///
}

カスタム投稿記事一覧判定

if (is_post_type_archive('カスタム投稿スラッグ')) {// arrayで複数可
///
}

カスタム投稿記事詳細判定

if (is_singular('カスタム投稿スラッグ')) {
///
}

タグ判定

if (is_tag()) {
///
}

タクソノミ判定

if (is_tax('タームスラッグ')) {
///
}

年別一覧判定

if (is_year()) {
///
}

月別一覧判定

if (is_month()) {
///
}

検索一覧判定

if (is_search()) {
///
}

404判定

if (is_404()) {
///
}

管理画面判定

if (is_admin()) {
///
}
4
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
4