Created
May 16, 2023 12:56
-
-
Save zackpyle/56137d0ccde0b62385397cbf61fa0991 to your computer and use it in GitHub Desktop.
Use the [URLParam param='paramName'] shortcode to display GET parameters from the current URL
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 // ignore this line - only for formatting | |
// Use the [URLParam param='paramName'] shortcode to display GET parameters from the current URL | |
function displayURLparam( $atts ) { | |
extract( shortcode_atts( array( | |
'param' => 'param', | |
), $atts ) ); | |
return esc_attr(esc_html($_GET[$param])); | |
} | |
add_shortcode('URLParam', 'displayURLparam'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment