iamntz/carbon-fields-urlpicker 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

iamntz/carbon-fields-urlpicker

最新稳定版本:3.0.10

Composer 安装命令:

composer require iamntz/carbon-fields-urlpicker

包简介

Carbon Fields extension that adds a URL picker field type.

README 文档

README

(this is an extension of Carbon Fields plugin)

You can install it via composer:

composer require iamntz/carbon-fields-urlpicker --prefer-dist 

If you install it from the source, you need to make sure that you also run npm install and npm run production in order to have assets compiled.

Return values:

The field will return an associative array with the following values:

url: the actual URL anchor: the text anchor (might be blank) blank: wether the link should open in a new window or not 

Example

Registering A Field

This goes in your functions.php as with other Carbon Fields fields. The only difference is that the type is urlpicker.

use Carbon_Fields\Container; use Carbon_Fields\Field; add_action( 'carbon_fields_register_fields', 'crb_url_picker_test' ); function crb_url_picker_test() { Container::make( 'post_meta', 'URL Picker Test' ) ->add_fields( array( Field::make( 'urlpicker', 'crb_my_link', 'URL Picker Test' ) ->set_help_text( "This is a test of the URL picker." ) )); }

Using Field Values

<?php $my_link = carbon_get_the_post_meta( 'crb_my_link' ); ?> <a href="<?= $my_link[url] ?>"<?= ( $my_link[blank] ? ' target="_blank"' : '') ?>><?= $my_link[anchor] ?></a>

Note that the blank field will return 0 or 1, depending on whether the checkbox is ticked next to "Open link in a new tab".

Found this useful?

You can get hosting (and receive $10 credit!), donate or buy me a gift.

统计信息

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

GitHub 信息

  • Stars: 14
  • Watchers: 3
  • Forks: 19
  • 开发语言: JavaScript

其他信息

  • 授权协议: GPL-2.0
  • 更新时间: 2026-01-04

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固