知言主題Tinection如何顯示多級/無限層級導航菜單?

有個剛學習WordPress建立站的朋友,測試使用WordPress知言主題(Tinection)。

  • 發現WordPress知言主題(Tinection)在默認情況下,只能顯示二級導航菜單……
  • 若要想獲取顯示更多菜單,想要手動修改WordPress代碼,對於剛學建站的新手來說,是有難度的……

下面陳溈亮分享的“知言主題Tinection顯示多級/無限層級導航菜單”的修改方法。

第1 步:修改style.css文件裡的樣式 

打開style.css文件,將以下樣式▼

.pri-nav ul ul ul {left: -999em; top: 0;}

改成 ▼

.pri-nav ul ul ul {left:125px; top: 0;}

第2步:修改header.php文件裡的代碼

打開header.php文件,將以下代碼▼

<?php wp_nav_menu( array( 'theme_location' => 'topbar', 'menu_class' => 'nav-menu', 'depth' => '2' ) ); ?>

改成 ▼

<?php wp_nav_menu( array( 'theme_location' => 'topbar', 'menu_class' => 'nav-menu', 'depth' => '0' ) ); ?>
  • 'depth' => '0' 表示顯示無限層級。

以下是WordPress知言主題(Tinection)導航菜單,顯示無限層級的顯示效果 ▼

WordPress知言主題(Tinection)導航菜單,顯示無限層級的顯示效果第1張

擴展閱讀 ▼

發表評論

您的郵箱地址不會被公開。 必填項已用 * 標註

回到頁首