
內容簡介
這個外掛可幫助您快速為您的專案(主題或外掛)設置標準的 WordPress 設置頁面。如此簡單!
以下是一個「Hello World」的代碼片段,可讓您快速了解它的功用。它會產生一個標準的設置頁面,具有核取方塊、完整的標記和儲存邏輯。
<?php
add_action( 'init', 'my_options_create_page', 11 ); function my_options_create_page() { $options_page = new Aff(); // Add a checkbox $options_page->add_field( array( 'name' => 'simple_checkbox', 'label' => __( 'Is this plugin awesome?', 'textdomain' ), 'type' => 'checkbox', 'description' => __( 'Help your users with a nice description.', 'textdomain' ), 'section' => 'general', // Optional. Default section. You can add new ones as easily as adding a field. ) ); // Render the page - this is mandatory $options_page->init(); ?>
為什麼要用這個設定外掛?
雖然設定外掛種類繁多,但「行政表格架構」以可擴展的物件形式撰寫,可輕易擴充以符合您的需求。這就是我們在 Dream Production 內部使用的內容。
開始使用
要瞭解完整的範例/設置頁面模板,請打開 examples 資料夾中的 my_options.php 檔案。
外掛標籤
開發者團隊
原文外掛簡介
This plugin will help you quickly set up a standard WordPress settings page for your project, be it a theme or a plugin. That’s it!
Below is a “Hello World” piece of code to quickly get you an idea. It will generate a standard settings page with a checkbox, complete markup, save logic.
add_field( array( 'name' => 'simple_checkbox', 'label' => __( 'Is this plugin awesome?', 'textdomain' ), 'type' => 'checkbox', 'description' => __( 'Help your users with a nice description.', 'textdomain' ), 'section' => 'general', // Optional. Default section. You can add new ones as easily as adding a field. ) ); // Render the page - this is mandatory $options_page->init(); ?>
There are a zillion options plugins out there. Why this?
All plugins will inevitably have their limitations, but Admin Form Framework is written in form of an object that can be easily extended to suit your needs. This is what we use internally at Dream Production.
Get started
For a complete example / settings page template, open up the included my_options.php file from examples folder.
