web-dev-qa-db-ja.com

Current_page_itemとcurrent-menu-itemの違いは何ですか

カスタムメニュー使用時のcurrent_page_itemcurrent-menu-itemの違い

.current_page_item{} // Class for Current Page
.current-cat{} // Class for Current Category
.current-menu-item{} // Class for any other current Menu Item
.menu-item-type-taxonomy{} // Class for a Category
.menu-item-type-post_type{} // Class for Pages
.menu-item-type-custom{} // Class for any custom item that you added
.menu-item-home{} // Class for the Home Link
4
JM at Work

current_menu_itemは、現在のメニュー要素のタイプ(page、archives、postなど)とは無関係に、メニュー内のアクティブな要素です。current_page_itemは、現在の項目がページで現在のものである場合にのみ使用可能です。

詳細については http://codex.wordpress.org/Dynamic_Menu_Highlighting

5
petermolnar