Smart Custom Fields

Smart Custom Fields is a simple plugin for managing custom fields.

Features

  • Field group loop support.
  • Meta data revision support.
  • Meta data preview support.

字段类型

  • 文字框
  • 文本区域
  • 单选
  • 选择
  • 多选
  • WYSIWYG editor
  • 影像
  • 档案
  • Related Posts
  • Related Terms
  • 颜色选择器
  • 日期选择器
  • Datetime picker
  • Boolean
  • Message

How to get meta data ?

**The return value of each of the following methods is not sanitized. Please sanitize them if necessary. **

https://developer.wordpress.org/apis/security/escaping/

Post meta data

This method can get any meta data.

This method can get meta data of any group.

This method can get all meta data.

User meta data

This method can get any user meta data.

This method can get user meta data of any group.

This method can get all user meta data.

Term meta data

This method can get any term meta data.

This method can get term meta data of any group.

This method can get all term meta data.

Custom options page meta data

This method can get any custom options page meta data.

This method can get custom options page meta data of any group.

This method can get all custom options page meta data.

Create custom options page

Register custom fields by the code.


<?php
/**
* カスタムフィールドを定義
*
* @param array $settings Smart_Custom_Fields_Setting オブジェクトの配列
* @param string $type 投稿タイプ or ロール
* @param int $id 投稿ID or ユーザーID
* @param string $meta_type post | user
* @return array
*/
function my_register_fields( $settings, $type, $id, $meta_type ) {
// SCF::add_setting( 'ユニークなID', 'メタボックスのタイトル' );
$Setting = SCF::add_setting( 'id-1', 'functions.php から追加 その1' );
// $Setting->add_group( 'ユニークなID', 繰り返し可能か, カスタムフィールドの配列 );
$Setting->add_group( 'group-name-1', false, array(
array(
'name' => 'field-1',
'label' => 'テストフィールド',
'type' => 'text',
),
array(
'name' => 'field-2',
'label' => 'テストフィール2',
'type' => 'text',
'default' => 2,
),
) );
$settings[] = $Setting;
return $settings;
}
add_filter( 'smart-cf-register-fields', 'my_register_fields', 10, 4 );
view raw

gistfile1.php

hosted with ❤ by GitHub

GitHub

https://github.com/inc2734/smart-custom-fields/

译:

You can translate this plugin into your language by using GlotPress.

0

评论0

 
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
显示验证码
没有账号?注册  忘记密码?

社交账号快速登录