wordpress怎么在文章左边添加标题跳转

wordpress怎么在文章左边添加标题跳转,第1张

1、使用UltimateBlocks插件。

2、添加跳转代码。WordPress是一款免费开源的内容管理系统(CMS),目前已经成为全球使用最多的CMS建站程序。根据W3techs的最新统计(截至2021年4月),在全球的所有网站中WordPress占有41%的市场份额。

1234567891011add_filter('comment_text', 'add_redirect_comment_link', 99)function add_redirect_comment_link($content = ''){ if(preg_match_all('|<a.*href=[\'"](http)(.*?)[\'"]|is', $content, $output)){ $i = count($output[1]) for ($n=0$n<$i$n++){$transformed = '<a href="go.php?url=http' . $output[2][$n] . '" target="_blank"' $content = str_replace($output[0][$n], $transformed, $content) } }return $content}

在主题文件夹的functions.php文件里加入上面的代码,go.php就是你自建的一个跳转页面。

可以用html中的a标签(xxx.html就是要跳转的链接):

1

<a href="xxx.html">跳转链接</a>

可以用js进行跳转:

1

<button onclick="window.location.href='xxx.html'">点击跳转</button>

以上两种方式达到的效果是一样的.


欢迎分享,转载请注明来源:内存溢出

原文地址: http://www.outofmemory.cn/bake/11722523.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-18
下一篇 2023-05-18

发表评论

登录后才能评论

评论列表(0条)

保存