承接 joanrodas/custom-code-fields 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

joanrodas/custom-code-fields

最新稳定版本:v0.1.13

Composer 安装命令:

composer require joanrodas/custom-code-fields

包简介

Add custom fields to WooCommerce products, CPT, terms, users and more, programatically and with ease.

README 文档

README

GitHub stars

Product fields library for WooCommerce developers.

✔️ Custom fields integrated with WooCommerce fields
✔️ Easily extendable with hooks


Getting started

composer require joanrodas/custom-code-fields

You can also install Custom Product Fields as a standalone WordPress plugin, simply downloading the zip and placing it in the plugins folder.


Examples

use CCF\Section\ProductSection;
use CCF\Field\Field;
use CCF\Field\RepeatableField;

add_action('ccf_register_fields', function () {
	ProductSection::create('section_slug', 'Section name', [
		Field::create('text', 'text_field', 'Text Field')
			->default_value('default')
		Field::create('textarea', 'textarea_field', 'Textarea Field'),
		Field::create('switch', 'switch_field', 'Switch Field'),
		Field::create('checkbox', 'checkbox_field', 'Checkbox Field'),
		Field::create('number', 'number_field', 'Number Field')
			->min(3)
			->max(23.5)
			->step(0.1)
			->set_datalist([1,2,5,10,15]),
		Field::create('html', 'html_inside', 'Inside html')
				->html('<b>Bold text</b>'),		
		Field::create('select', 'select_field', 'Select Field')->set_options('add_select_options'),
		Field::create('rich_text', 'rich_text_field', 'Rich Text Field'),
		RepeatableField::create('repeatable_field', 'Repeatable Field', [
			Field::create('password', 'password_inside', 'Inside password'),
			Field::create('url', 'url_inside', 'Inside url')
				->set_datalist(['https://plubo.dev']),
			Field::create('time', 'time_inside', 'Inside time')
				->set_datalist(['10:20']),
			Field::create('date', 'date_inside', 'Inside date')
				->set_datalist(['2023-02-02', '2023-02-01']),
			Field::create('color', 'color_field', 'Color Field')
				->set_datalist(['#ffdede', '#f3d4de']),
			
		]),
	])
		->if_tab('general')
		// ->if_product_type(['simple', 'variable'])
		// ->if_checked('virtual')
		;
});

function add_select_options() {
	return [
		'option_1' => 'Option 1',
		'option_2' => 'Option 2',
		'option_3' => 'Option 3',
		'option_4' => 'Option 4'
	];
}

Contributions

contributions welcome GitHub issues GitHub license

Feel free to contribute to the project, suggesting improvements, reporting bugs and coding.

统计信息

  • 总下载量: 10
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: GPL-3.0
  • 更新时间: 2025-03-25