WP functions.php url with variable


WP functions.php url with variable

我有这个:

printf( '<cite class="fn"><a href="http://www.xxx.it/dialogueroom/?page_id=64&username=">%s</a></cite>', get_comment_author_link() );

我想用%s变量建立我的url

像这样的东西:

<a href="http://www.xxx.it/dialogueroom/?page_id=64&username=%s">%s</a>

但它不起作用。

你能帮我吗?

谢谢!

S

在字符串中有多个占位符。参数交换:

printf( 
    '<cite class="fn"><a href="http://www.xxx.it/dialogueroom/?page_id=64&username=%1$s">%2$s</a></cite>',
    $username,
    get_comment_author_link()
);
printf( '<cite class="fn"><a href="http://www.break-out.it/dialogueroom/?page_id=64&username=%1$s">%2$s</a></cite>', get_comment_author(), get_comment_author_link() );

这个工作:)谢谢迪吉。解决方案来自您的