wordpress - 如何在 Wordpress 博客视图页面上显示链接
问题描述
我正在开发基于 Wordpress 的网站并尝试在 Wordpress 博客视图页面上显示链接(请参阅此处的页面),但链接会自动转换为纯文本。我试过这段代码但没有成功:
<?php
function keep_my_links($text) {
global $post;
if ( '' == $text ) {
$text = get_the_content('');
$text = apply_filters('the_content', $text);
$text = str_replace('\]\]\>', ']]>', $text);
$text = preg_replace('@<script[^>]*?>.*?</script>@si', '', $text);
$text = strip_tags($text, '<a>');
}
return $text;
}
remove_filter('get_the_excerpt', 'wp_trim_excerpt');
add_filter('get_the_excerpt', 'keep_my_links');
?>
谁能帮我解决这个问题?
解决方案
推荐阅读
- javascript - 如何使弹出窗口仅在实际提交表单时调用javascript
- javascript - R reactable _如何截断单元格内容并在悬停时显示?
- nlp - 使用 Dialogflow 检测任意数量的意图
- javascript - CORS 策略已阻止从源“http://localhost:3000”访问“https://www.cloudflare.com/cdn-cgi/trace”获取
- ios - 如何以编程方式使用 myapp 文件夹打开默认文件应用程序?
- javascript - React 和 Express 在不同的 localhost 端口上运行,但 CORS 没有阻止 fetch 调用
- c++ - 从 C++ 派生类的 this 获取共享指针
- php - AJAX PHP 服务器端响应,但我无法在客户端页面中显示响应
- erlang - Erlang中带注释的元组类型的用例是什么?
- c# - 为什么在此 LINQ 查询中销毁后使用 db 上下文?