[wordpress插件] Admin Form Framework管理表格框架

wordpress 插件 文章 2020-02-03 10:00 562 0 全屏看文

AI助手支持GPT4.0

评分

0

0

描述

This plugin will help you quickly set up a standard WordPress settings page for your project, be it a theme or a plugin.

此插件将帮助您快速为您的项目设置标准的WordPress设置页面,无论是主题还是插件。

That’s it!

就是这样!

Below is a “Hello World” piece of code to quickly get you an idea.

下面是一段“ Hello World”代码,可以帮助您快速理解。

It will generate a standard settings page with a checkbox, complete markup, save logic.

它将生成带有复选框,完整标记,保存逻辑的标准设置页面。

  <?php 

add_action( 'init', 'my_options_create_page', 11 );

add_action('init','my_options_create_page',11);

function my_options_create_page() { $options_page = new Aff();

函数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'

//添加一个复选框$ options_page-> add_field(array('name'=>'simple_checkbox','label'=> __('这个插件很棒吗?','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

,'description'=> __('帮助您的用户提供一个不错的描述。','textdomain'),'section'=>'general',//可选。默认部分。您可以像添加一个

field. ) );

));

// Render the page - this is mandatory $options_page->init();

//渲染页面-这是强制性的$ 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.

所有插件都不可避免地会有其局限性,但是Admin Form Framework是以对象的形式编写的,可以轻松扩展以适应您的需求。

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.

有关完整的示例/设置页面模板,请从 examples 文件夹中打开包含的my_options.php文件。

安装步骤

    1. Upload to the /wp-content/plugins/ directory
    2. 上传到 / wp-content / plugins / 目录

    3. Activate the plugin through the ‘Plugins’ menu in WordPress
    4. 通过WordPress中的“插件”菜单激活插件

    5. Follow the instructions to get started with your first settings page.
    6. 按照说明开始第一个设置页面。

下载地址

https://downloads.wordpress.org/plugin/admin-form-framework.zip

https://downloads.wordpress.org/plugin/admin-form-framework.zip

-EOF-

AI助手支持GPT4.0