[WordPress] 外掛分享: Atom Builder

首頁外掛目錄 › Atom Builder
WordPress 外掛 Atom Builder 的封面圖片
全新外掛
安裝啟用
尚無評分
2281 天前
最後更新
問題解決
WordPress 4.7+ v1.0.2 上架:2017-11-30

內容簡介

這個外掛允許你使用Widget建立網頁內容,而非使用佈景主題預設的網頁版面配置。

使用Atom Builder

預設只支援基本頁面,外掛為所有頁面註冊一個Widget區域。
為了避免管理區域變得混亂,新註冊的Widget區域不會顯示在佈景主題的標準區域旁邊,您必須在客製化器中直接存取它們。
操作展示:
* 登入網站並訪問任何一頁,點擊「客製化」連結。
* 在客製化面板中,點擊「Widget」,您應該會看到一個Widget區域已註冊到您的頁面。
* 使用您需要的Widget建立頁面內容。

這個外掛提供了三個額外的Widget,幫助您建立有趣的頁面內容和版面配置:Atom Builder Page、Atom Builder Post和Atom Builder Posts Widget。
這些基本Widget在未來可能會變得更複雜,並且有更多選項,稍後還會添加幾個自定Widget,但那是一個開始。

為Atom Builder添加佈景主題支援

預設情況下,Atom Builder使用「the_content」篩選器替換您的頁面內容。這意味著您之前的任何標記,例如標題,都會被保留。
只有您在管理區域中編輯器中的內容被替換。

如果您想要完全替換頁面內容,您需要稍微調整您的主題代碼。

在您的子佈景主題的functions.php文件中添加Atom Builder支援,只需添加以下片段。

`
add_action( 'after_setup_theme', 'mythemeprefix_add_atom_builder_support' );
/**

添加Atom Builder支援
這將停用對the_content的基本篩選器。
只需使用atom_builder_get_template_part()替換您在page.php中的get_template_part()調用,即可使用註冊的Widget替換整個頁面內容模板。
**/
function mythemeprefix_add_atom_builder_support(){
add_theme_support( 'atom-builder' );
}
`

在您的子佈景主題的文件夾中複製page.php模板。

使用相同的參數將get_template_part()函數調用替換為atom_builder_get_template_part()(基本上只需要添加前綴即可)。
現在一切都應該運作正常了,現在您的整個模板都被Widget替換,而不僅僅是您的內容。

外掛標籤

開發者團隊

⬇ 下載最新版 (v1.0.2) 或搜尋安裝

① 下載 ZIP → 後台「外掛 › 安裝外掛 › 上傳外掛」
② 後台搜尋「Atom Builder」→ 直接安裝(推薦)
📦 歷史版本下載

原文外掛簡介

This plugin simply allows you to build your page content with widgets instead of using the default page layout for your theme.
Using the Atom Builder
By default, only basic pages are supported. It basically registers a widget area for all of your pages.
To avoir cluttering the admin area, the newly registered widget areas do not appear alongside your theme’s standard ones, and you have to access them directly in the customizer.
To see it in action :
* Just visit any page on your site while logged in, and click the ‘Customize’ link.
* In the Customizer panel, click on ‘Widgets’ and you should see a widget area registered for your page.
* Just use the widgets you need to build your page content.
This plugin provides you with 3 additional widgets to help you build your page with interesting content and layout: Atom Builder Page, Atom Builder Post, and Atom Builder Posts widgets.
These basic widgets will probably get a bit more complex and have more options in the future, and a few more custom widgets will be added later, but that’s a start.
Adding theme support for the Atom Builder
By default, the Atom Builder replaces your page content using ‘the_content’ filter. That means any markup you have before, such as the title for example, will be kept.
Only your content as it appears in the editor in the admin area is replaced.
If you want to replace the whole content for your page, you’ll have to tweak your theme’s code a little bit.

Add theme support for the Atom builder in your child theme’s functions.php file by simply adding this snippet.
`
add_action( ‘after_setup_theme’, ‘mythemeprefix_add_atom_builder_support’ );
/**

Add theme support for the Atom Builder
This deactivate the basic filter on the_content.
Just replace your get_template_part() call in page.php with atom_builder_get_template_part() to replace your whole page content template with registered widgets.
**/
function mythemeprefix_add_atom_builder_support(){
add_theme_support( ‘atom-builder’ );
}
`

Duplicate the page.php template from your theme in your child theme’s folder.

Replace the get_template_part() function call with atom_builder_get_template_part(), with the same parameters. (Basically all you need to do is prefix it.)
Now everything should work fine. Your whole template is replaced with widgets now, not just your content.

延伸相關外掛

文章
Filter
Apply Filters
Mastodon