This add on for the already established Advanced Custom Fields plugin adds a new field type called ‘Link Picker’ which allows the user to enter a URL, or select from the existing pages.
已添加的“高级自定义字段”插件的添加项添加了一个名为“链接选择器”的新字段类型,该类型允许用户输入URL或从现有页面中进行选择。
It is a thin wrapper around the link selector included with the WYSIWYG field editor.
它是WYSIWYG字段编辑器随附的链接选择器的精简包装。 p>
This plugin is forked from the plugin of the same name hosted at https://github.com/BIOSTALL/ACF-Link-Picker-Field.
此插件来自托管在https://github.com/BIOSTALL/ACF-Link-Picker-Field的同名插件。
This version is hosted at https://github.com/ahebrank/ACF-Link-Picker-Field and issues and PRs should be submitted there.
此版本托管在https://github.com/ahebrank/ACF-Link-Picker-Field,并且问题和PR应该在此处提交。 p>
Note: Advanced Custom Fields must be installed for this add-on to work.
注意:必须安装高级自定义字段,此附件才能正常工作。 p>
Compatibility
兼容性 h3>
This ACF field type is compatible with:
此ACF字段类型兼容: p>
- ACF 5
- ACF 5 li>
- ACF 4
- ACF 4 li>
ul>
ACF 4 support is deprecated, and new plugin features will generally not work with ACF 4.
不支持ACF 4,新插件功能通常不适用于ACF 4。 em> p>Usage
用法 h3>
When outputting the link selection on the front end, you will have three object elements available:
在前端输出链接选择时,将有三个可用的对象元素: p>
$mylink = get_field('mylink'); $ mylink = get_field('mylink');var_dump($mylink);
var_dump($ mylink);
code> pre>
Outputs:
输出: p>
array(3) { array(3){ ["url"]=>
[“ url”] =>
string(31) "http://mysite.com/selected/url/"
字符串(31)“ http://mysite.com/selected/url/”
["title"]=>
[“标题”] =>
string(10) "Link Title"
字符串(10)“链接标题”
["target"]=>
[“目标”] =>
string(6) "_blank"
字符串(6)“ _blank”
["postid"]=>
[“ postid”] =>
int 2231
2231年
}
}
code> pre>