內容簡介
這個外掛允許你創建無限量的自訂側邊欄/小工具區域,並切換現有區域。你可以不需要更動你的佈景主題就能達成這個目的。
這個外掛利用了分類詞元 API,所以它只支援 WordPress 4.4 及以上版本。
當你呼叫 dynamic_sidebar() 函式時,你的佈景主題需要使用 is_active_sidebar() 函式。
這將有效運作。
if ( is_active_sidebar( 'sidebar-1' ) ) {
dynamic_sidebar( 'sidebar-1' );
}
這將無法運作。
dynamic_sidebar( 'sidebar-1' );
如果你只想輸出自訂的側邊欄,請在你的佈景主題中顯示側邊欄的位置放置以下程式碼。
do_action( 'dynamically_dynamic_sidebar' );
這個外掛已發佈於 GitHub 上。
您可以創建無限量自訂側邊欄/小工具區域,並依照分類、標籤、自訂分類等進行切換。若要更進一步了解,可以查看「螢幕擷圖」選項卡,瞭解更多細節。
外掛標籤
開發者團隊
原文外掛簡介
This plugin enables you to create unlimited custom sidebar/widget areas and switch existing areas. You can do this without touching your theme.
This plugin utilizes term meta api and so it works only with WordPress 4.4 and above.
Your theme needs to use is_active_sidebar() when calling dynamic_sidebar() function.
This will work.
if ( is_active_sidebar( 'sidebar-1' ) ) {
dynamic_sidebar( 'sidebar-1' );
}
This doesn’t work.
dynamic_sidebar( 'sidebar-1' );
If you only want to output your custom sidebar, put this code on where you want to display the sidebar in your theme.
do_action( 'dynamically_dynamic_sidebar' );
This Plugin published on GitHub.
ウィジェットエリアをいくつでも定義し、カテゴリやタグ、カスタム分類ごとに差し替えたり、投稿・ページ・カスタム投稿から使いたいサイドバーを指定したりすることができます。「スクリーンショット」のタブをごらんいただくと、イメージが湧きやすいと思います。
