內容簡介
這個外掛允許您在整個網站上建立管理員可管理的內容區塊。您只需在想要出現該區塊的地方添加少量的程式碼(php 或 shortcode),然後在管理面板中進行編輯即可。非常易於使用,並允許創建無限數量的區塊。
歡迎前往以下網址協助開發此外掛: https://github.com/wesf90/wp-wf-sections
使用方法
您可以通過實施它們來建立區塊。您可以通過管理員面板創建它們,路徑為 Admin > Sections > Add New,但這不是預期的使用方式。
在管理面板中的內容中創建區塊,只需在您的頁面、文章或小工具中添加以下shortcode,即可:
[wf_section title="My New Section"]
要在您的網站的任何 php 文件中建立區塊,只需使用以下代碼:
<?php new WF_Section('My New Section'); ?>
添加了此代碼後,該區塊將自動在管理員面板的“部分”區域中創建。您隨後可以從那裡編輯內容。
區塊選項
此外掛提供了許多選項,可以實現更快的開發和更輕鬆的實現,無論您是使用shortcode還是PHP方法進行實現。
PHP
此代碼的默認值為:
WF_Section($title, $ad=false, $echo=true);
要改變這些默認值,只需按以下方式編寫代碼:
new WF_Section('My section'); // 簡單放置,並顯示內容
new WF_Section('My ad', '300x250'); // 創建帶有預先填充廣告圖像的區塊。非常適合練習!
new WF_Section('My echo section', false, true); // 不顯示為廣告,返回內容而不是顯示它
要允許更多功能,請使用數組分配您的選項(默認值如上所示):
new WF_Section(array(
'title' => '', // 區塊的標題
'default' => '', // 創建時的默認內容
'shortcodes' => true, // 解析內容中的shortcodes?
'ad' => false, // 這是廣告嗎?如果是,請放置尺寸,例如“300x250”
'echo' => true // 顯示內容還是返回內容
));
Shortcode
使用shortcode時,要設置您的自定義選項,只需將選項名稱添加到shortcode調用中。選項及其默認值與上述PHP方法相同:
[wf_section title="Your Title" default="The default content upon creation" shortcodes=true ad="300x250" echo=true]
創建廣告放置
此外掛還允許您通過在shortcode或函數調用中設置大小,快速創建分段廣告放置。預先填充的臨時圖像將作為區塊的內容。可以隨時將其刪除並替換為您的實際廣告代碼。這是創建設計模型的理想工具。
任意區域
外掛標籤
開發者團隊
原文外掛簡介
This plugin allows you to create admin-manageable content sections across your site. You simply add the small code (php or shortcode) where you would like the section to appear, then edit it in the admin panel. Extremely easy to use, and allows an unlimited number of sections to be created.
Feel free to help develop this plugin at: https://github.com/wesf90/wp-wf-sections
How to Use
You create sections by implementing them into your website. You can create them via Admin > Sections > Add New, however that is not the intended use.
To create a section in the content of your site via the admin panel, simply add the following shortcode to your page, post, or widget.
[wf_section title="My New Section"]
To create a section anywhere in a php file of your website, simply use the following code:
After adding this code, the section will automatically create itself in the admin panel’s “Section” area. You can then edit the content from there.
Section Options
This plugin offers a number of options which allow for quicker development, and easier implementation, whether you’re using the shortcode or the PHP method to implement it.
PHP
The defaults for this code are:
WF_Section($title, $ad=false, $echo=true);
To alter these defaults, simply write the code as:
new WF_Section('My section'); // Simple placement with echo
new WF_Section('My ad', '300x250'); // Created a section with a pre-filled ad image. Great for wireframing!
new WF_Section('My echo section', false, true); // Doesn't display as an ad, and returns the content instead of echoing it
To allow even more features, use an array to assign your options (defaults are shown):
new WF_Section(array(
'title' => '', // The title of the section
'default' => '', // The default content upon creation
'shortcodes' => true, // Parse shortcodes inside the content?
'ad' => false, // Is this an ad? If so, place the dimensions such as '300x250'
'echo' => true // Echo or return the content
));
Shortcode
To set your own options when using the shortcode, simply add the option name to the shortcode call. The options and their defaults are the same as listed above for the PHP method:
[wf_section title="Your Title" default="The default content upon creation" shortcodes=true ad="300x250" echo=true]
Creating Ad Placements
This plugin also allows you to quickly create sectional ad placements by setting the size in the shortcode or function call (shown above). A pre-filled stand-in image will be inserted as the content of your section by default. This can always be taken out later and replaced with your actual ad’s code. This is a great tool for creating design mockups.
Arbitrary section
