2012-07-17 56 views
0

我想用PHP来显示当前页面的QR码。 the_permalink()在我的论坛中返回为空白。WordPress的小工具问题

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

+0

您错过了QR码位。你需要把QR api放回回应 – 2012-07-17 03:30:36

+0

我故意留下了。出于测试原因。 3: – 2012-07-17 03:45:00

回答

1

the_permalink()应该在循环中使用。如果您想获取当前的帖子链接,请使用get_permalink

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

那......已经工作了。谢谢! – 2012-07-17 03:44:04