Skip to main content

Link

Use the WP Link popup to select existing content and a title.

Value

Returns { text: string, href: string, target: string }

$value = json_decode(fx_get_meta('id'), true);
$text = $value['text'];
$href = $value['href'];
$target = $value['target'];

printf('<a href="%s" target="%s">%s</a>', $href, $target, $text);

Example

'id' => [
'type' => 'link',
'className' => 'my-class-name',
'title' => 'Button',
'buttonText' => 'Add button link',
'buttonEditText' => 'Edit button link',
],

Functions

echo fx_get_link('id', 'link-class');

Returns <a class="link-class" href="link-url" target="link-target" aria-label="Link Text">Link Text</a>

Props

buttonEditText

Alternate text for the edit link button

type: string

defaultValue: 'Edit link'

buttonText

Alternate text for the add link button

type: string

defaultValue: 'Add link'

className

Metabox class name

type: string

title

Metabox title

type: string