Created
November 13, 2015 20:55
-
-
Save nathaningram/e4223705b0efb5fb86da to your computer and use it in GitHub Desktop.
Design to Builder Shortcodes for functions.php
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
//Anti-Spam Email Shortcode | |
//Use this shortcode [emailme]nathan@brilliantly.net[/emailme] | |
function protect_email_address( $atts , $content=null ) { | |
for ($i = 0; $i < strlen($content); $i++) $encodedmail .= "&#" . ord($content[$i]) . ';'; | |
return '<a href="mailto:'.$encodedmail.'">'.$encodedmail.'</a>'; | |
} | |
add_shortcode('emailme', 'protect_email_address'); | |
//Current Year Shortcode | |
function year_shortcode() { | |
$year = date('Y'); | |
return $year; | |
} | |
add_shortcode('year', 'year_shortcode'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment