• Dear plugin author,

    I added support for short links to the function and fixed some issues. Feel free to include my changes in the next version.

    
    function the_post_qrcode( $size = '150', $opts = [] ) {
    	$opts += [
    			"fore_color" => null,
    			"back_color"=> null,
    			"margin" => null,
    			"short" => false,
    		];
    	
    	$src = add_query_arg( 'text', urlencode( $opts["short"] ? wp_get_shortlink() : get_permalink() ), site_url('/lh_qr_codes/') );
    	
    	if ($opts["fore_color"]){
    		$src = add_query_arg( 'fore_color', $opts["fore_color"], $src );
    	}
    	
    	if ($opts["back_color"]){
    		$src = add_query_arg( 'back_color', $opts["back_color"], $src );
    	}
    	
    	if ($opts["margin"]){
    		$src = add_query_arg( 'margin', $opts["margin"], $src );
    	}
    	
    	$src = apply_filters( 'lh_qr_codes_template_src', $src);
    	
    	echo '<img src="'.$src.'" height="'.$size.'" width="'.$size.'" />';
    }

    Best regards

    • This topic was modified 6 years, 2 months ago by joerns.
    • This topic was modified 6 years, 2 months ago by joerns. Reason: fixed default value
Viewing 1 replies (of 1 total)
  • Plugin Author shawfactor

    (@shawfactor)

    I will add support for shortlinks when I overall the plugin in version 1.10 (which will be the next version).

    No support as yet in version 1.06 which is the one I released today so maybe hold of on upgrading

    Pete

Viewing 1 replies (of 1 total)
  • The topic ‘Fix and short link support’ is closed to new replies.