Php 在短代码函数中使用回显
我正在使用Wordpress插件来显示帖子标签的谷歌新闻提要 我想说的是:Php 在短代码函数中使用回显,php,wordpress,Php,Wordpress,我正在使用Wordpress插件来显示帖子标签的谷歌新闻提要 我想说的是: <?php echo strip_tags(get_the_tag_list('','+','')); ?> 进入此echo的Google URI的单引号: <?php echo do_shortcode( '[hungryfeed url="https://news.google.com/news/feeds?q='[[above function here]]'&output=rss"
<?php echo strip_tags(get_the_tag_list('','+','')); ?>
进入此echo的Google URI的单引号:
<?php echo do_shortcode( '[hungryfeed url="https://news.google.com/news/feeds?q='[[above function here]]'&output=rss" template="1" max_items="1"]' ); ?>
您需要将第一个代码存储到变量中,然后将变量放入url中。像这样的东西可能有用
<?php
$tags = strip_tags(get_the_tag_list('','+',''));
echo do_shortcode('[hungryfeed url="https://news.google.com/news/feeds?q='.$tags.'&output=rss" template="1" max_items="1"]');
?>
完美!我最初只是摆弄使用一个变量,所以很高兴看到正确的方法。我只是在do_短代码之前重新添加了echo。