【发布时间】:2014-04-26 19:42:17
【问题描述】:
我为我的 WordPress 使用了一个按钮简码(见下文)。
如您所见,我可以选择颜色,放置链接,为目标属性指定一些内容。
我想将 rel nofollow 添加到这个 wordpress 按钮链接短代码,但我不知道该怎么做。
add_shortcode('button', 'shortcode_button');
function shortcode_button($atts, $content = null) {
$atts = shortcode_atts(
array(
'color' => 'black',
'link' => '#',
'target' => '',
), $atts);
return '[raw]<span class="button ' . $atts['color'] . '"><a href="' . $atts['link'] . '" target="' . $atts['target'] . '">' .do_shortcode($content). '</a></span>[/raw]';
}
谢谢
【问题讨论】:
-
你想要那种动态的?
-
不知道你说的动态是什么意思? (对不起,我是菜鸟)基本上,我将使用按钮短代码创建的所有下一个按钮链接都需要在 nofollow 中。
-
好的,我已经发布了答案尝试一下。
标签: wordpress shortcode nofollow