Last active
August 29, 2015 14:10
-
-
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/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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