Skip to content

Instantly share code, notes, and snippets.

@Manoz
Created March 31, 2014 19:14
Show Gist options
  • Save Manoz/9899929 to your computer and use it in GitHub Desktop.
Save Manoz/9899929 to your computer and use it in GitHub Desktop.
<?php
/* Remove an old shortcode.
* Code by @boiteaweb
*/
/*
* Exemple:
* [button color="babyblue" link="http://manoz.fr/facebook-template/2012-Facebook-template.zip" target="_blank"]Télécharger le template[/button]
*/
add_shortcode( 'button', 'sc_button' );
function sc_button( $atts=null, $content=null ) {
extract( shortcode_atts( array( // defaults
'link' => '#',
'color' => 'blue',
'target' => '_blank',
), $atts ) );
return sprintf( '<a href="%s" class="%s" target="%">%s</a>', $link, $color, $target, $content );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment