Or, embed this snippet using GenerateWP WordPress Plugin.

Download

Clone

Content CTA

Injects a CTA in the body of a post/page

// Add Shortcode
function content_cta_shortcode( $atts , $content = null ) {

	// Attributes
	$atts = shortcode_atts(
		array(
			'content' => 'Put your call to action content in here',
			'button_link' => 'https://google.com',
			'button_text' => 'Button Text Goes Here',
		),
		$atts,
		'content-cta'
	);

	$has_button = isset($atts['button_link']);
	$button_link = $atts['button_link'];
	$button_text = $atts['button_text'];
	
	$result = '<div class="content-cta-container">';
	$result .= '<div class="content-cta-content">' . $content . '</div>';
	$result .= ($has_button ? '<a class="content-cta-link" href="' . $button_link . '>' . $button_text . '</a>' : '');
	$result .= '</div>';
	
	return $result;

}
add_shortcode( 'content-cta', 'content_cta_shortcode' );