【问题标题】:Exclude tags from tag cloud in wordpress从 wordpress 中的标签云中排除标签
【发布时间】:2012-04-15 06:16:48
【问题描述】:

所以我在一篇文章中有 2 组不同的标签,我们称它们为列表 A 和 B。列表 A 是整个网站的标签云。列表 B 包含与帖子相关的标签或关键字。现在,列表 B 中的一些单词在列表 A 中重复。我试图找出列表 B 中的单词在列表 A(标签云)中不重复的方法。有没有一种简单的方法可以做到这一点。我对这一切都很陌生,所以我很感激你的帮助。

<?php wp_tag_cloud('smallest=10&largest=10&format=flat&unit=px&separator=, &exclude=<?php the_tags();>'); ?>

【问题讨论】:

    标签: wordpress tags


    【解决方案1】:

    您正在尝试将 php 标记嵌入到单引号字符串中。你不能这样做,请参阅here

    你可以这样做:

    $args = array(
        'smallest' => 10,
        'largest' => 10,
        'format' => 'flat',
        'unit' => 'px',
        'separator' => ',',
        'exclude' => 'cats,dogs');
    wp_tag_cloud($args);
    

    the_tags() 会回显,您需要使用 get_the_tags() 代替。

    【讨论】:

      猜你喜欢
      • 2021-01-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多