Keith Gadberry
Keith Gadberry

Reputation: 174

Wordpress Widget Issues

I'm trying to use PHP to display a QR code for the current page. the_permalink() returns as blank on my Forums.

function the_qrcode( $permalink ) {
    if($permalink == '') {
        $permalink = 'http://eternityofgamers.com/forums';
    }

    echo $permalink;
}

In the PHP-enabled text widget, I have <?php the_qrcode(the_permalink()); ?>

On the main page, $permalink is echoed as http://eternityofgamers.com/archives/74http://eternityofgamers.com/forums instead of http://eternityofgamers.com/archives/74.

Upvotes: 0

Views: 38

Answers (1)

zourbuth
zourbuth

Reputation: 908

The the_permalink() should be used in a Loop. If you want to get the the current post link, use the get_permalink.

<?php the_qrcode(get_permalink()); ?>

Upvotes: 1

Related Questions