如何在Wordpress博客查看页面上显示链接

时间:2019-01-31 12:44:11

标签: wordpress

我正在基于Wordpress的网站上工作,并试图在Wordpress博客视图页面(请参阅第here页)上显示链接,但是这些链接会自动转换为纯文本。我尝试过此代码,但没有成功:

<?php
function keep_my_links($text) {
  global $post;
if ( '' == $text ) {
    $text = get_the_content('');
    $text = apply_filters('the_content', $text);
    $text = str_replace('\]\]\>', ']]&gt;', $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');
?>

有人可以帮我解决这个问题吗?

0 个答案:

没有答案
相关问题