Last active
December 16, 2020 19:17
-
-
Save nathaningram/f4edfd5994b44b4a586aa181ab34f4f0 to your computer and use it in GitHub Desktop.
Deconstruction: Brilliantly.net (Part One) - URL Variable Shortcode
This file contains hidden or 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
| //Years Since Shortcode | |
| //usage [years-since date='2010-01-01'] | |
| function bww_years_since($atts, $content = null) { | |
| extract(shortcode_atts(array("date" => ''), $atts)); | |
| if(empty($date)) { | |
| return "<br /><br />************No date provided************<br /><br />"; | |
| } | |
| $mdr_unix_date = strtotime($date); | |
| $mdr_time_difference = time() - $mdr_unix_date ; | |
| $years = floor($mdr_time_difference / 31556926 ); | |
| $num_years_since = $years; | |
| return $num_years_since .' years'; | |
| } | |
| add_shortcode('years-since', 'bww_years_since'); | |
| // URL Parameter Shortcode Size | |
| // PressNest Plan Match Page | |
| function bww_url_param_shortcode_size() { | |
| return $_GET['size']; | |
| } | |
| add_shortcode( 'url-size', 'bww_url_param_shortcode_size' ); | |
| // URL Parameter Shortcode Sell | |
| // PressNest Plan Match Page | |
| function bww_url_param_shortcode_sell() { | |
| return $_GET['sell']; | |
| } | |
| add_shortcode( 'url-sell', 'bww_url_param_shortcode_sell' ); | |
| // URL Parameter Shortcode Changes | |
| // PressNest Plan Match Page | |
| function bww_url_param_shortcode_changes() { | |
| return $_GET['changes']; | |
| } | |
| add_shortcode( 'url-changes', 'bww_url_param_shortcode_changes' ); | |
| // URL Parameter Shortcode Help | |
| // PressNest Plan Match Page | |
| function bww_url_param_shortcode_help() { | |
| return $_GET['help']; | |
| } | |
| add_shortcode( 'url-help', 'bww_url_param_shortcode_help' ); | |
| // URL Parameter Shortcode First Name | |
| // PressNest Plan Match Page & Schedule Discover Call Page | |
| function bww_url_param_shortcode_firstname() { | |
| return $_GET['firstname']; | |
| } | |
| add_shortcode( 'url-firstname', 'bww_url_param_shortcode_firstname' ); | |
| // URL Parameter Shortcode Email | |
| // Schedule Discover Call Page | |
| function bww_url_param_shortcode_email() { | |
| return $_GET['email']; | |
| } | |
| add_shortcode( 'url-email', 'bww_url_param_shortcode_email' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment