這個外掛並未在最新的 3 個 WordPress 主要版本上進行測試。開發者可能不再對這個外掛進行維護或提供技術支援,並可能會與更新版本的 WordPress 產生使用上的相容性問題。

Sidebar Shortcode

外掛說明

Features:

  • Add sidebars to WP Posts and Pages with shortcodes using a sidebar Name or sidebar ID.
  • Add one or more optional custom classes to match your theme styles or custom CSS styles.

How to Use:

Method 1 – (Recommended Use: Add a sidebar using a sidebar Name.)

A sidebar Name can be found in the Appearance > Widgets section of your WordPress Admin Area.

Example uses:

  • [sidebar name="your-sidebar-name"]
  • [sidebar name="your-sidebar-name" class="custom-class"]
  • [sidebar name="your-sidebar-name" class="custom-class-1 custom-class-2 custom-class-3"]

Method 2 – (Advanced WP Users: Add a sidebar using a sidebar ID.)

A sidebar ID can be found in your theme’s register_sidebar functions, usually in the theme’s functions.php file.

Example uses:

  • [sidebar id="your-sidebar-id"]
  • [sidebar id="your-sidebar-id" class="custom-class"]
  • [sidebar id="your-sidebar-id" class="custom-class-1 custom-class-2 custom-class-3"]

General Notes

  • The spelling and capitalization of a shortcode Name or ID must exactly match that of the desired sidebar.
  • Definition of an active sidebar: An active sidebar is a sidebar that contains widgets.
  • A [sidebar] shortcode without an active sidebar Name or active sidebar ID displays nothing.
  • An active sidebar ID overrides a sidebar Name if both are present in the same shortcode.
  • There is no limit to the number of shortcodes that can be used on the same page or post.
  • The same sidebar shortcode can be used multiple times on the same page or post.

HTML Class Notes

  • Separate multiple custom classes using a space character. Examples shown in Method sections above.
  • There is no limit to the number of custom classes that can be used.
  • Each custom class must only contain (letter,number,-,_) characters, otherwise all custom classes are omitted.
  • The sidebar ID is always added to the HTML class attribute if it contains only (letter,number,-,_) characters.

Demo:

Visit Plugin URI

螢幕擷圖

  • How to find a sidebar Name.
  • How to find a sidebar ID.
  • Example use of the shortcode.

安裝方式

  1. Install the plugin using the Plugins menu in your WordPress Admin Area or upload the plugin folder to the /wp-content/plugins/ directory.
  2. Activate the plugin through the Plugins menu in your WordPress Admin Area.
  3. Add sidebar shortcodes using the instructions in the above How to Use section.

常見問題集

Why is my shortcode not working as expected?

Either no widgets are in the desired sidebar or the shortcode attributes are incorrect. See instructions in the above How to Use section.

How can a sidebar Name be found?

Sidebar Names can be found in the Appearance > Widgets section of your WordPress Admin Area. See the Method sections and Screenshots section for details.

How can a sidebar ID be found?

Advanced WP users can find sidebar IDs in the active theme’s register_sidebar functions, usually in the theme’s functions.php file.
See the Method sections and Screenshots section for details.
See also: https://codex.wordpress.org/Function_Reference/register_sidebar

How many custom classes can be used?

There is no limit to the number of custom classes.

Can a sidebar Name and sidebar ID be used in the same shortcode?

Yes, but a valid sidebar ID will override a sidebar Name if both are present in the same shortcode.

使用者評論

2023 年 4 月 20 日
This works really great! Exactly what I needed. Could you please make this for Blog Posts too? I just want to pull my blog posts, exactly as they are created, on to a "page". Thanks for creating the sidebar shortcode!
2019 年 5 月 6 日
Works wonderful with siteorigin html sidebar. I just used the code [sidebar name='Sidebar']
閱讀全部 3 則使用者評論

參與者及開發者

以下人員參與了開源軟體〈Sidebar Shortcode〉的開發相關工作。

參與者

將〈Sidebar Shortcode〉外掛本地化為台灣繁體中文版

對開發相關資訊感興趣?

任何人均可瀏覽程式碼、查看 SVN 存放庫,或透過 RSS 訂閱開發記錄

變更記錄

1.0.0

  • Initial release.