Created
December 13, 2018 07:08
-
-
Save ssbalakumar/7e3ef295a73fcf97056029084cc0af8e to your computer and use it in GitHub Desktop.
Visual Composer Link sortcode and vc map / Anchor tag with visual composer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//vc_link ++ vc_param | |
array( | |
'type' => 'vc_link', | |
'heading' => __( 'Button', 'my-text-domain' ), | |
'param_name' => 'url', | |
), | |
//Shortcode | |
function vc_link_demo( $atts, $content = null) { | |
extract(shortcode_atts(array( | |
'url' => '' | |
), $atts)); | |
//Link construct | |
$url = ($url=='||') ? '' : $url; | |
$url = vc_build_link( $url ); | |
$a_link = $url['url']; | |
$a_title = ($url['title'] == '') ? '' : 'title="'.$url['title'].'"'; | |
$a_target = ($url['target'] == '') ? '' : 'target="'.$url['target'].'"'; | |
//Anchor Tag | |
$button = $a_link ? '<a class="btn btn-md btn-black" href="'.$a_link. '" '.$a_title.' '.$a_target.'>'.$url['title'].'</a>' : ''; | |
$anchorTag = $button; | |
return $anchorTag; | |
} | |
add_shortcode('link_demo', 'vc_link_demo'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment