我正在使用Wordpress插件显示帖子标签的Google新闻Feed。
我正试着说:
<?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"]' ); ?>
我不是特别擅长PHP;任何人都可以建议最好的方法吗?
谢谢!
答案 0 :(得分: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"]');
?>