[wordpress插件] Advanced Custom Fields: Link Picker Field高级自定义字段:链接选择器字段

wordpress 插件 文章 2020-01-26 23:00 602 0 全屏看文

AI助手支持GPT4.0

评分

100

100

描述

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字段编辑器随附的链接选择器的精简包装。

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应该在此处提交。

Note: Advanced Custom Fields must be installed for this add-on to work.

注意:必须安装高级自定义字段,此附件才能正常工作。

Compatibility

兼容性

This ACF field type is compatible with:

此ACF字段类型兼容:

    • ACF 5
    • ACF 5

    • ACF 4
    • ACF 4

    ACF 4 support is deprecated, and new plugin features will generally not work with ACF 4.

    不支持ACF 4,新插件功能通常不适用于ACF 4。

    Usage

    用法

    When outputting the link selection on the front end, you will have three object elements available:

    在前端输出链接选择时,将有三个可用的对象元素:

      • url – The URL of the page
      • url –页面的URL

      • title – The title of the link, if entered
      • title –链接的标题(如果输入)

      • target – Will be either a blank string or ‘_blank’, depending on whether the user has ticked the box for the link to open in a new window/tab.
      • 目标–将为空白字符串或“ _blank”,具体取决于用户是否已勾选要在新窗口/标签中打开链接的框。

      • postid – Not available as part of wp_link, this is an ajax hack to attempt to look up the post ID of a selected link.

      • postid –不能作为wp_link的一部分使用,这是一个ajax hack,试图查找所选链接的post ID。

        This will return 0 if the post ID was not found.

      • 如果找不到帖子ID,则返回0。

      Code example:

      代码示例:

      $mylink = get_field('mylink');

        $ mylink = get_field('mylink');

      var_dump($mylink);

      var_dump($ mylink);

      Outputs:

      输出:

      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年

      }

      }

安装步骤

    1. Copy the acf-link_picker folder into your wp-content/plugins folder
    2. acf-link_picker 文件夹复制到您的 wp-content / plugins 文件夹

    3. Activate the ‘Advanced Custom Fields: Link Picker’ plugin via the plugins admin page
    4. 通过插件管理页面激活“高级自定义字段:链接选择器”插件

    5. Create a new field via ACF and select the Link Picker type
    6. 通过ACF创建新字段,然后选择“链接选择器”类型

下载地址

https://downloads.wordpress.org/plugin/acf-link-picker-field.zip

https://downloads.wordpress.org/plugin/acf-link-picker-field.zip

-EOF-

AI助手支持GPT4.0