lp__link_html( $value, $text = "", $atts = [] )

The function first processes the attributes specified in the $atts array and builds a string of HTML attributes.

Plugin

Namespace

Launchpad

Parameters

string

$value

Link the URL or href attribute of the link

string

$text

Link the text to be displayed within the link

array

$atts

Link tag attributes

Return

string

Link html

Source

File: \includes\lp-utility-functions.php

function lp__link_html( $value, $text = "", $atts = [] ){
    $link_atts = [];
    if( is_array( $atts ) ) foreach( $atts as $k => $v ){
        if( $k && $v ) $link_atts[] = "{$k}='{$v}'"; 
        elseif( $k ) $link_atts[] = "{$k}"; 
    }
    $text = $text ? $text : $value;
    ob_start();
    if( $value ): 
        ?><a href="<?= $value; ?>" <?=implode( " ", $link_atts )?>><?php _e( $text ); ?></a><?php 
    endif; 
    return ob_get_clean();
}