Add the below code to your functions.php
function btn_shortcode( $atts, $content = null ) {
$a = shortcode_atts( array(
'class' => '',
'href' => '#',
'style' => '',
'target' => ''
), $atts );
// return '<a class="btn-accent-primary" href="' . esc_attr($a['href']) . '" target="' . esc_attr($a['target']) . '">' . $content . '</a>';
return '<a class="' . esc_attr($a['class']) . '" href="' . esc_attr($a['href']) . '" style="' . esc_attr($a['style']) . '" target="' . esc_attr($a['target']) . '">' . $content . '</a>';
// [button href="#" class="btn btn-lg btn-default" style="font-weight:bold; margin-top:50px; background-color: #999"]Learn More[/button]
}
add_shortcode( 'button', 'btn_shortcode' );
Below is the shortcode you would use in the Gutenberg or text editor area.
[button href="#" style="font-weight:bold; margin-top:50px; background-color: #999" target="_blank"]Learn More[/button]
Have any questions or comments? Write them below!