QR code for current URL
-
It would be great to be able to use the QR shortcode in a widget and show the current URL. That way a mobile user could easily share a post with another user via QR code when talking in person.
I found this https://ww.wp.xz.cn/support/topic/get-site-url-shortcode/
and https://mekshq.com/get-current-page-url-wordpress/
I put this in a snippet but can’t seem to get them to work together to create a shortcode of [current_url].
Nor do I understand how to nest shortcodes.
[su_qrcode data=”[current_url]” size=”150″ margin=”5″]Using Code Snippets:
global $wp;
$current_url = home_url( add_query_arg( array(), $wp->request ) );add_action( ‘init’, function() {
add_shortcode( ‘current_url’, function( $atts = null, $content = null ) {
return $current_url;
} );
} );
The topic ‘QR code for current URL’ is closed to new replies.