Add button for iThemes Exchange product
uses the CSS ‘button’ class to style a button w/ link to an iThemes Exchange product. Takes product slug as content and optional attribute to change button text.
// Add Shortcode
function itc_class_button_shortcode( $atts , $content = null ) {
// Attributes
extract( shortcode_atts(
array(
'button_txt' => 'Enroll here',
), $atts )
);
// Code
return '<a class="button" href="' . home_url() . '/product/' . $content . '/">'. $button_txt . '</a>';
}
add_shortcode( 'itc-class', 'itc_class_button_shortcode' );