Wordpress小工具问题


Wordpress Widget Issues

我正在尝试使用PHP来显示当前页面的二维码。the_permalink()在我的论坛上以空白形式返回。

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

在启用PHP的文本小部件中,我有<?php the_qrcode(the_permalink()); ?>

在主页面上,$permalink被回显为http://eternityofgamers.com/archives/74http://eternityofgamers.com/forums,而不是http://eternityofgamers.com/archives/74

应该在循环中使用_permink()。如果要获取当前帖子链接,请使用get_permink。

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