Skip to content
Radoslav Georgiev edited this page Oct 21, 2018 · 3 revisions

Purpose

The Link builds on top of the WP_Object field, which allows editors to select various types of objects. In addition to that, in the Link field, editors may also simply enter a custom URL instead of selecting an object.

Play Preview Video

Options

The Link field builds on top of the WP Object field, inheriting many of its options:

Output Format

Even though the Link field works on top of the WP Object field, because of the type of saved data there are no output options. Both get_value and the_value will return a URL if something is selected.

Usage

You can use the normal field name, as well as <field_name>_target for retrieving values. Using only the field name will return the URL, while using the target will return either _self or _blank.

<a href="<?php the_value( 'button_link' ) ?>" target="<?php the_value( 'button_link_target' ) ?>">
    Click me!
</a>
Clone this wiki locally