Created
July 24, 2024 18:05
-
-
Save dgoze/e8bc84c2ac41642e96547cb12a74b736 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 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
<?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