getfluid
3/9/2018 - 7:23 PM

CTA Button Shortcode

CTA Button Shortcode

// CTA Button Shortcode
function cta_button($atts) {

	extract(
		shortcode_atts([
			'text' => 'Button',
			'url' => '#',
			'align' => 'left',
			'heading' => ''
		], $atts)
	);

	if($heading) {
		$heading = '<h5>' . $heading . '</h5>';
	}

	return '
		<div class="cta-button-wrap" style="text-align:' . $align . '">
			' . $heading .'
			<a class="button" href="' . $url . '">' . $text  . '</a>
		</div>
	';

}
add_shortcode('button', 'cta_button');