
內容簡介
重要註記:
此外掛程式需要至少 PHP 5.3 及以上版本。
此外掛程式是針對開發人員,並非一般使用者使用。
Nmwdhj 是一個用於以程式化方式創建、編輯和渲染表單的 API。此外掛程式沒有圖形使用者介面,它只是 PHP 和 WordPress 開發人員的輔助庫。
您可以使用此外掛程式在後台的 Meta Box、前端或任何需要表單的地方中建立單獨的表單元素。
基本範例
根據您的需要,您可以以多種方式使用此外掛程式,以下範例僅用於學習用途:
簡單的 WordPress 搜尋表單:
Nmwdhj\create_element( array( ‘type’ => ‘form’, ‘atts’ => array( ‘method’ => ‘GET’, ‘role’ => ‘search’, ‘action’ => home_url( ‘/’ ), ), ‘elements’ => array( ‘search’ => array( ‘name’ => ‘s’, ‘type’ => ‘input_search’, ‘value’ => get_search_query(), ‘atts’ => array( ‘placeholder’ => _x( ‘在此網站搜尋...’, ‘placeholder’ ), ‘class’ => ‘search-text’, ‘required’ => true, ), ), ‘submit’ => array( ‘type’ => ‘input_submit’, ‘value’ => __( ‘搜尋’ ), ), ), ) )->output();
簡單的登入表單:
Nmwdhj\create_element( array( ‘type’ => ‘form’, ‘atts’ => array( ‘method’ => ‘POST’, ), ) ) ->add( array( ‘name’ => ‘user_name’, ‘type’ => ‘input_text’, ‘label’ => __( ‘使用者名稱’ ), ) ) ->add( array( ‘name’ => ‘user_pass’, ‘type’ => ‘input_password’, ‘label’ => __( ‘密碼’ ), ) ) ->add( array( ‘name’ => ‘user_submit’, ‘type’ => ‘input_submit’, ‘value’ => __( ‘提交’ ), ) ) ->output();
貢獻
開發人員可以在Nmwdhj GitHub 存儲庫上貢獻原始碼。
外掛標籤
開發者團隊
原文外掛簡介
Important Notes:
This plugin requires at least PHP 5.3.x .
This plugin is for developers, not general users.
Nmwdhj is an API for creating, editing and rendering forms programmatically. This plugin doesn’t have a GUI, It’s only a helper library for the PHP & WP developers.
You can use this plugin to create individual form elements in the meta boxes, front-end, or anything else you might want a form for.
Basic Examples
You can use this plugin in many ways depending on your needs, this examples only for learning purposes:
Simple WordPress Search Form:
Nmwdhj\create_element( array( ‘type’ => ‘form’, ‘atts’ => array( ‘method’ => ‘GET’, ‘role’ => ‘search’, ‘action’ => home_url( ‘/’ ), ), ‘elements’ => array( ‘search’ => array( ‘name’ => ‘s’, ‘type’ => ‘input_search’, ‘value’ => get_search_query(), ‘atts’ => array( ‘placeholder’ => _x( ‘Search this site…’, ‘placeholder’ ), ‘class’ => ‘search-text’, ‘required’ => true, ), ), ‘submit’ => array( ‘type’ => ‘input_submit’, ‘value’ => __( ‘Search’ ), ), ), ) )->output();
Simple Login Form:
Nmwdhj\create_element( array( ‘type’ => ‘form’, ‘atts’ => array( ‘method’ => ‘POST’, ), ) ) ->add( array( ‘name’ => ‘user_name’, ‘type’ => ‘input_text’, ‘label’ => __( ‘User Name’ ), ) ) ->add( array( ‘name’ => ‘user_pass’, ‘type’ => ‘input_password’, ‘label’ => __( ‘Password’ ), ) ) ->add( array( ‘name’ => ‘user_submit’, ‘type’ => ‘input_submit’, ‘value’ => __( ‘Submit’ ), ) ) ->output();
Contributing
Developers can contribute to the source code on the Nmwdhj GitHub Repository.
