Skip to content

Instantly share code, notes, and snippets.

@puikinsh
Last active August 29, 2015 14:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save puikinsh/133770bfe41e9a57c3fb to your computer and use it in GitHub Desktop.
Save puikinsh/133770bfe41e9a57c3fb to your computer and use it in GitHub Desktop.
WordPress shortcodes with attributes. Originally published on http://colorlib.com/wp/shortcodes-can-add-life-wordpress-themes/
<?php
// Enhanced subscription feature with attributes
function subscribe_multilink_shortcode( $atts ) {
extract( shortcode_atts( array(
'subtype' => 'RSS',
'subtypeurl' => 'http://feeds.feedburner.com/MyBlog',
), $atts, 'multilink' ) );
return sprtinf( 'Get our posts and latest updates delivered directly to your inbox<a href="%1$s">by %2$s</a>.',
esc_url( $subtypeurl ),
esc_html( $subtype )
);
}
add_shortcode( 'subscribe', 'subscribe_multilink_shortcode' );
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment