前言介紹
- 這款 WordPress 外掛「Admin Page Framework」是 2013-02-13 上架。
- 目前有 100 個安裝啟用數。
- 上一次更新是 2022-04-15,距離現在已有 1115 天。超過一年沒更新,安裝要確認版本是否可用。以及後續維護問題!
- 外掛最低要求 WordPress 3.4 以上版本才可以安裝。
- 有 23 人給過評分。
- 還沒有人在論壇上發問,可能目前使用數不多,還沒有什麼大問題。
外掛協作開發者
pcraig3 | miunosoft | michael-uno |
外掛標籤
api | options | settings | developers | admin pages |
內容簡介
簡化 WordPress 插件和主題開發所需之時間
開發 WordPress 插件和主題最耗時的部分之一,便是建立設定頁面。當您越來越多地撰寫插件和主題時,您會發現很大一部分程式碼可以重複使用。Admin Page Framework 的目標,是提供可重複使用的程式碼,以消除一遍又一遍地編寫重複程式碼的必要性。
使用此框架,您可以更有組織地構建選項頁面。擴展函式庫類別並將定義表單元素的陣列傳遞給預定義的類別方法,函式庫會處理所有複雜的程式碼,替您建立頁面和表單。
為您的用戶創建必要的頁面和表單元件
頂級頁面、子頁面和頁面標籤 - 讓您的用戶訪問操作插件或主題的頁面。
表單 - 讓您的用戶儲存其選項。
自訂文章類型 - 在文章清單中建立自定義欄位。
自訂分類和欄位 - 在分類定義頁面中儲存與分類關聯的選項。
元框和欄位 - 儲存與設定的文章關聯的元數據。還可以將元框添加到使用此框架創建的頁面。
小工具和欄位 - 根據用戶在前端所設定的設定,展示模組化的輸出。
網路管理員頁面和表單 - 在 WordPress 多網站管理員區域中建立管理員頁面。
構建簡單而更複雜的設定表單
選項標籤 - 表單部分可以顯示在選項標籤框內。
可摺疊部分 - 表單部分可折疊和擴展。
可重複部分和欄位 - 動態添加/移除表單部分和欄位。
可排序部分和欄位 - 拖放表單部分和欄位以更改順序。
嵌套部分和欄位 - 嵌套部分和欄位以構建複雜的表單。
導入和導出選項 - 用戶可以通過上傳和下載文本文件,導入和導出設定。
重設按鈕 - 讓您的用戶初始化已儲存的選項。
驗證和錯誤消息 - 使用預定義的驗證回調,可以驗證用戶提交的表單數據。此外,通過設置錯誤陣列,可以向用戶顯示錯誤訊息。
上下文幫助窗格 - 可將幫助資訊添加到每個畫面右上方顯示的上下文幫助窗格中。
自訂欄位類型 - 可註冊自己的欄位類型。這使您可以設計自己的欄位,例如結合了核取方塊和文字欄位的欄位。
聯絡表單 - 接收內嵌於管理員頁面中的聯絡表單發送的用戶反饋和問題報告的電子郵件。
工具提示 - 在部分和欄位標題旁添加小型彈出視窗,讓用戶閱讀有關選項的說明。
利用框架可擴展性製作一系列產品
如果您計畫創建一個產品,可能可擴展的功能數量無限制,請利用框架的本機可擴展性。使用自動創建的鉤子,實現高度擴展的管理員頁面和表單。換句話說,它可以使其他開發人員自定義您的插件或主題,進而促進您的項目增長。
此外,將框架用作函式庫,您的插件或主題不必需要安裝額外的依賴。因此,您的產品將完全可攜。
內建欄位類型
text — 用戶可輸入純文字的欄位。
textarea — 用戶可輸入多行純文字的欄位。
password — 用戶可輸入 password。
mail — 用戶可輸入 email。
url — 用戶可輸入 URL。
number — 用戶可輸入數值,也可以帶有範圍。
select — 用戶可以從選項中選擇的下拉式菜單。
checkbox — 帶有勾選框的欄位。
radio — 讓用戶從幾個預設選擇中進行單選的欄位。
hidden — 設定為隱藏欄位。
media — 設定為媒體上傳欄位。
原文外掛簡介
Reduce the Time Spent for Plugin and Theme Development
One of the time-consuming part of developing WordPress plugins and themes is creating setting pages. As you more and more write plugins and themes, you will soon realize major part of code can be reused. Admin Page Framework aims to provide reusable code that eliminates the necessity of writing repeated code over and over again.
You will have more organized means of building option pages with the framework. Extend the library class and pass your arrays defining the form elements to the predefined class methods. The library handles all the complex coding behind the scene and creates the pages and the forms for you.
Create Essential Page and Form Components for Your Users
Top-level Page, Sub Pages, and In-page Tabs – where your users will access to operate your plugin or theme.
Forms – to let your users store their options.
Custom Post Types – and the custom columns in the post listing table.
Custom Taxonomies and Fields – store options associated with a taxonomy in the taxonomy definition page.
Meta Boxes and Fields – store meta data associated with posts of set post types. Also meta boxes can be added to the pages created with the framework.
Widgets and Fields – display modular outputs based on the user’s settings in the front end.
Network Admin Pages and Forms – create admin pages in the newtork admin area of WordPress multi-sites.
Construct Simple Yet Complex Setting Forms
Section Tabs – form sections can be displayed in a tabbed box.
Collapsible Sections – form sections can be collapsed and expanded.
Repeatable Sections and Fields – dynamically add/remove form sections and fields.
Sortable Sections and Fields – drag and drop form sections and fields to change the order.
Nested Sections and Fields – nest sections and fields to construct complex forms.
Import and Export Options – buttons that the user can import and export settings by uploading and downloading text files.
Reset Button – let your users to initialize the saved options.
Validation and Error Messages – with the pre-defined validation callbacks, the user’s submitting form data can be verified. Furthermore, by setting the error array, you can display the error message to the user.
Contextual Help Pane – help information can be added to the contextual help pane that appears at the top right of each screen.
Custom Field Types – your own field type can be registered. This allows you to design own fields such as a combination of a checkbox with a text field.
Contact Form – receive emails of user feedback and issue reports sent via the contact form embedded in an admin page.
Tooltips – add a small pop-up box beside section and field title for the users to read about the option.
Produce a Series of Products with the Framework Extensibility
If you are planning to create a product possibly extended with an unlimited number of add-ons, take advantage of the framework’s native extensibility. The created admin pages and forms will become highly extensible with the automatically created hooks. In other words, it empowers other developers to customize your plugin or theme. That will result on making your projects grow.
Also, use the framework as a library and your plugin or theme does not have to require an extra dependency to be installed. Therefore, your product will be perfectly portable.
Built-in Field Types
text – a normal field to enter text input.
password – a masked text input field.
textarea – a text input field with multiple lines. It supports TinyMCE rich text editor.
radio – a set of radio buttons that lets the user pick an option.
checkbox – a check box that lets the user enable/disable an item.
select – a drop-down list that lest the user pick one or more item(s) from a list.
hidden – a hidden field that will be useful to insert invisible values.
file – a file uploader that lets the user upload files.
image – a custom text field with the image uploader script that lets the user set an image URL.
media – a custom text field with the media uploader script that lets the user set a file URL.
color – a custom text field with the color picker script.
submit – a submit button that lets the user send the form.
export – a custom submit field that lets the user export the stored data.
import – a custom combination field of the file and the submit fields that let the user import data.
posttype – a set of check-lists of taxonomies enabled on the site in a tabbed box.
taxonomy – check-lists of taxonomies enabled on the site in a tabbed box.
size – a combination field of the text and the select fields that let the user set sizes with a selectable unit.
section_title – a text field placed in the section title to let the user name the section.
system – displays the site system information.
inline_mixed – consists of inline elements of fields with different field types.
Bundled Custom Field Types
With custom field types, you can create more detailed customized field outputs. The demo component includes the following example custom field types.
sample – a sample custom field type with a JavaScript script.
github – displays GitHub buttons.
path – lets the user select file paths on the server.
toggle – lets the user toggle a switch button.
no_ui_slider – lets the user set values between ranges with a slider.
select2 – lets the user select items from a predefined list which cam be populated with AJAX.
post_type_taxonomy – lets the user select taxonomy terms of selected post types.
If you want a field type that are not listed here, you can check the field type pack or request a new one in the forum.
Getting Started
To get started, go to Dashboard -> Admin Page Framework -> About -> Getting Started.
Demo
Activate the demo pages to see the possible features of the framework. To activate it, go to Dashboard -> Admin Page Framework -> Add Ons -> Demo.
Documentation
Online Documentation
Tutorials
Notes: this framework does not do anything by itself. If you are not a developer, you do not need this.
Use Unique Page Slug
The framework internally uses the add_submenu_page() function to register sub menu pages. When the same page slug is registered for multiple root pages, only the last registered callback gets triggered. The other ones will be ignored.
This means if you choose a very simple page slug such as about for your plugin/theme’s information page and then if there is another plugin using the same page slug, your users will get either of your page or the other.
To avoid this, make sure to use a unique page slug. One way to do that is to add a prefix like apf_about.
Use the files generated with the component generator
There is one thing you need to be careful when you include the framework: the framework version conflicts. Imagine you publish a plugin using the framework v3.4.6 and your plugin user installs a plugin using the framework v3.0.0 which is below your framework version. If the other plugin loads earlier than yours, your plugin may not work properly and vice versa.
There is a way to avoid such a conflict: change the PHP class names of the framework you include. All the class names have the prefix AdminPageFramework so just change it to something like MyPlugin_AdminPageFramework.
Go to Dashboard -> Admin Page Framework -> Tools -> Generator. Set the prefix in the option field and download the files.
If you do not modify the framework class names, you are supposed to extend the AdminPageFramework factory class.
class MyAdminPage extends AdminPageFramework {
...
}
When you modify the framework class names, make sure you extend the class with the modified name.
class MyAdminPage extends MyPlugin_AdminPageFramework {
...
}
For more detailed instruction, go to Dashboard -> Admin Page Framework -> About -> Getting Started.
By the time WordPress’s minimum required PHP version becomes 5.3 or higher, we can use name spaces then this problem will be solved.
Change Framework’s System Messages
The default messages defined by the framework can be changed. For example, when you import a setting with the framework, the setting notice “The options have been updated.” will be displayed.
If you want to change it to something else, modify the oMsg object. It has the aMessages public property array holding all the messages that the framework uses.
Get comfortable with the ‘attributes’ array argument
In each field definition array, you can set the attributes arguments which defines the HTML attributes of the field so that you can modify the output of the field by passing attribute values.
The argument accepts the values as an array. Each element represents the attribute’s name and value. The array key corresponds to the name of the attribute and the value to the attribute value.
For example,
array(
'field_id' => 'interval',
'title' => __( 'Interval', 'task-scheduler' ),
'type' => 'number',
'attributes' => array(
'min' => 0,
'step' => 1,
'max' => 24,
),
),
In addition, you can change the attributes of the following container elements by setting their key and passing a nested attribute array.
fieldrow – the td tag element containing the field output.
fieldset – the fieldset tag element containing the field output.
fields – the div tag element containing the sub-fields and the main field.
field – the div tag element containing each field.
This submit button will float right.
array(
'field_id' => 'submit',
'type' => 'submit',
'save' => false,
'value' => __( 'Save', 'task-scheduler' ),
'label_min_width' => 0,
'attributes' => array(
'field' => array(
'style' => 'float:right; clear:none; display: inline;',
),
),
)
For meta box and widget form fields (as they have slightly different styling than generic admin pages),
array(
'field_id' => 'submit_in_meta_box',
'type' => 'submit',
'save' => false,
'show_title_column' => false,
'label_min_width' => 0,
'attributes' => array(
'field' => array(
'style' => 'float:right; width:auto;',
),
),
),
Change Preview Image Size of the ‘image’ Field Type
To specify a custom size to the preview element of the image field type, set an attribute array like the below, where 300px is the max width.
array(
'field_id' => 'my_image_field_id',
'title' => __( 'Image', 'admin-page-framework-demo' ),
'type' => 'image',
'attributes' => array(
'preview' => array(
'style' => 'max-width: 200px;',
),
),
),
Display items of ‘radio’ field type one per line
To display radio button items one per line, set the label_min_width to 100%.
array(
'field_id' => 'my_radio_field_id',
'title' => __( 'Radio Button', 'admin-page-framework-demo' ),
'type' => 'radio',
'label_min_width' => '100%',
'label' => array(
'a' => __( 'This is a.', 'admin-page-framework-demo' ),
'b' => __( 'This is b.', 'admin-page-framework-demo' ),
'c' => __( 'This is a.', 'admin-page-framework-demo' )c
),
),
Set default field value
To set the initial value of a field, use the default argument in the field definition array.
array(
'field_id' => 'my_text_field_id',
'title' => __( 'My Text Input Field', 'admin-page-framework-demo' ),
'type' => 'text',
'default' => 'This text will be displayed for the first time that the field is displayed and will be overridden when a user set an own value.',
),
Always display a particular value in a field
The value argument in the definition array can suppress the saved value. This is useful when you want to set a value from a different data source or create a wizard form that stores the data in a custom location.
array(
'field_id' => 'my_text_field_id',
'title' => __( 'My Text Input Field', 'admin-page-framework-demo' ),
'type' => 'text',
'value' => 'This will be always set.',
),
If it is a repeatable field, set values in numerically indexed sub-elements.
array(
'field_id' => 'my_text_field_id',
'title' => __( 'My Text Input Field', 'admin-page-framework-demo' ),
'type' => 'text',
'repeatable' => true,
'value' => 'the first value',
array(
'value' => 'the second value',
),
array(
'value' => 'the third value',
),
),
Alternately, you may use the options_{instantiated class name} filter to suppress the options so that setting the value argument is not necessary.
See examples, https://gist.github.com/michaeluno/c30713fcfe0d9d45d89f, https://gist.github.com/michaeluno/fcfac27825aa8a35b90f,
各版本下載點
- 方法一:點下方版本號的連結下載 ZIP 檔案後,登入網站後台左側選單「外掛」的「安裝外掛」,然後選擇上方的「上傳外掛」,把下載回去的 ZIP 外掛打包檔案上傳上去安裝與啟用。
- 方法二:透過「安裝外掛」的畫面右方搜尋功能,搜尋外掛名稱「Admin Page Framework」來進行安裝。
(建議使用方法二,確保安裝的版本符合當前運作的 WordPress 環境。
1.0.2 | 1.0.3 | 1.0.4 | 2.0.0 | 2.0.1 | 2.0.2 | 2.1.2 | 2.1.3 | 2.1.4 | 2.1.5 | 2.1.6 | 2.1.7 | 3.0.0 | 3.0.1 | 3.0.2 | 3.0.3 | 3.0.4 | 3.0.5 | 3.0.6 | 3.1.0 | 3.1.1 | 3.1.2 | 3.1.3 | 3.1.4 | 3.1.5 | 3.1.6 | 3.1.7 | 3.2.0 | 3.2.1 | 3.3.0 | 3.3.1 | 3.3.2 | 3.3.3 | 3.4.0 | 3.4.1 | 3.4.2 | 3.4.3 | 3.4.4 | 3.4.5 | 3.4.6 | 3.5.0 | 3.5.2 | 3.5.3 | 3.5.4 | 3.5.5 | 3.5.6 | 3.5.7 | 3.5.8 | 3.5.9 | 3.6.0 | 3.6.1 | 3.6.2 | 3.6.3 | 3.6.4 | 3.6.5 | 3.6.6 | 3.7.0 | 3.7.1 | 3.7.2 | 3.7.3 | 3.7.4 | 3.7.5 | 3.7.6 | 3.7.7 | 3.7.8 | 3.7.9 | 3.8.0 | 3.8.1 | 3.8.2 | 3.8.3 | 3.8.4 | 3.8.5 | 3.8.6 | 3.8.7 | 3.8.8 | 3.8.9 | 3.9.0 | 3.9.1 | trunk | 3.5.10 | 3.5.11 | 3.5.12 | 3.7.10 | 3.7.11 | 3.7.12 | 3.7.13 | 3.7.14 | 3.7.15 | 3.8.10 | 3.8.11 | 3.8.12 | 3.8.13 | 3.8.14 | 3.8.15 | 3.8.16 | 3.8.17 | 3.8.18 | 3.8.19 | 3.8.20 | 3.8.21 | 3.8.23 | 3.8.24 | 3.8.25 | 3.8.26 | 3.8.27 | 3.8.28 | 3.8.29 | 3.8.30 | 3.8.31 | 3.8.32 | 3.8.33 | 3.8.34 | 1.0.0.0 | 1.0.0.1 | 1.0.0.2 | 1.0.1.1 | 1.0.1.2 | 1.0.2.1 | 1.0.2.2 | 1.0.2.3 | 1.0.3.1 | 1.0.3.2 | 1.0.3.3 | 1.0.4.1 | 1.0.4.2 | 1.0.4.3 | 1.0.4.4 | 2.1.7.1 | 2.1.7.2 | 3.0.0.1 | 3.0.1.1 | 3.0.1.2 | 3.0.1.3 | 3.0.1.4 | 3.4.5.1 | 3.5.1.1 | 3.5.7.1 | 3.7.6.1 |
延伸相關外掛(你可能也想知道)
Admin Helper 》啟用此外掛後,您可以使用以下功能:, , register_post_box($posttype,$boxname,$description,$position,$priority,$form_fields):將具有自訂欄位的框框插入...。