目次
投稿タイプ関連(post_type)
全ての投稿タイプを取得
get_post_types()
カスタム投稿タイプもここに入ってくる
カスタム投稿タイプに絞る場合はarray('_builtin' => false)
投稿タイプでpublic
だけを取得する場合はarray('public' => true)
←これでpostやpageタイプのカスタム投稿も含めることができます。
array (size=11)
'post' => string 'post' (length=4)
'page' => string 'page' (length=4)
'attachment' => string 'attachment' (length=10)
'revision' => string 'revision' (length=8)
'nav_menu_item' => string 'nav_menu_item' (length=13)
現在のページの投稿タイプ
get_post_type()
get_query_var('post_type')
string 'post' (length=4)
タクソノミー関連(taxonomy)
全てのタクソノミー名を取得
get_taxonomies()
array (size=7)
'category' => string 'category' (length=8)
'post_tag' => string 'post_tag' (length=8)
'nav_menu' => string 'nav_menu' (length=8)
'link_category' => string 'link_category' (length=13)
'post_format' => string 'post_format' (length=11)
現在のページのタクソノミー名を取得
get_post_taxonomies()
date_i18n()
WordPressでdate()関数を使うとUTCで取得されるため以下の関数を使う
date_i18n('Y.m.d')