Skip to content

Instantly share code, notes, and snippets.

@chekle
Created July 13, 2023 02:06
Show Gist options
  • Save chekle/64ef6bc6910ee44cac43fc3ae26781a5 to your computer and use it in GitHub Desktop.
Save chekle/64ef6bc6910ee44cac43fc3ae26781a5 to your computer and use it in GitHub Desktop.
Custom Shortcode Button
/* Custom shortcode button function */
add_shortcode( 'action-button', 'action_button_shortcode' );
function action_button_shortcode( $atts ) {
extract( shortcode_atts(
array(
'title' => 'Title',
'url' => ''
),
$atts
));
return '<a href="' . $url . '" class="primary-btn">' . $title . '</a>';
}
/* Shortcode */
[action-button title="Make a booking" url="https://yourwebsite.co.nz/book-now/"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment