Plugin / Advanced Custom Fields: Link Picker Field

caalami

Description

Description

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. It is a thin wrapper around the link selector included with the WYSIWYG field editor.

This plugin is forked from the plugin of the same name hosted at 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.

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

Compatibility

This ACF field type is compatible with:

  • ACF 5
  • ACF 4

ACF 4 support is deprecated, and new plugin features will generally not work with 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
  • title – The title of the link, if entered
  • 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.
  • 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. This will return 0 if the post ID was not found.

Code example:

$mylink = get_field('mylink');
var_dump($mylink);

Outputs:

array(3) {
  ["url"]=>
  string(31) "http://mysite.com/selected/url/"
  ["title"]=>
  string(10) "Link Title"
  ["target"]=>
  string(6) "_blank"
  ["postid"]=>
  int 2231
}

Ratings

5
2 reviews

Rating breakdown

Details Information

Version

1.2.8

First Released

18 Sep, 2015

Total Downloads

8,703

Wordpress Version

3.5 or higher

Tested up to:

4.8.11

Require PHP Version:

-

Tags

Contributors

Languages

The plugin hasn't been transalated in any language other than English.

DIRECTORY DISCLAIMER

The information provided in this THEME/PLUGIN DIRECTORY is made available for information purposes only, and intended to serve as a resource to enable visitors to select a relevant theme or plugin. wpSocket gives no warranty of any kind, express or implied with regard to the information, including without limitation any warranty that the particular theme or plugin that you select is qualified on your situation.

The information in the individual theme or plugin displayed in the Directory is provided by the owners and contributors themselves. wpSocket gives no warranty as to the accuracy of the information and will not be liable to you for any loss or damage suffered by you as a consequence of your reliance on the information.

Links to respective sites are offered to assist in accessing additional information. The links may be outdated or broken. Connect to outside sites at your own risk. The Theme/Plugin Directory does not endorse the content or accuracy of any listing or external website.

While information is made available, no guarantee is given that the details provided are correct, complete or up-to-date.

wpSocket is not related to the theme or plugin, and also not responsible and expressly disclaims all liability for, damages of any kind, arising out of the use, reference to, or reliance on, any information or business listed throughout our site.

Keep Leading Your Followers!
Share it for them.