首页 文章

在wordpress帖子中缺少锚标记

提问于
浏览
1

有没有办法使用_excerpt在帖子中显示锚点或链接 . 在wordpress编辑器中,我在帖子的开头放置了一个锚标记 . 当我查看完整的文章时,它可以正常工作 . 但是在使用摘录时它不起作用 .

这是帖子的图片 . 我甚至强调了这个词

http://i255.photobucket.com/albums/hh140/testament1234/anchortag_zpsf77fbef2.jpg

这是我检查视图源时的代码 . 正如您所看到的,facebook.com链接变成了段落而不是锚链接 .

<div class="content">
              <!--TEXT -->
              <p>www.facebook.com Nullam dictum eleifend neque facilisis pellentesque. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur cursus mollis tincidunt. Donec tincidunt, augue ullamcorper pharetra porta, metus turpis volutpat urna, nec [...]</p>


             <a class="readmore" href="http://localhost/wordpress/sample-post-14/"><span>Full Article</span></a>
       </div>

我怎么解决这个问题?如果我用the_content替换了_excerpt,它将显示该帖子的内容 .

2 回答

  • 0

    问题是默认情况下,the_excerpt函数会禁用所有HTML标记 . 这就是为什么所有的链接都消失了 .

    您可能需要自定义the_excerpt函数返回的内容,并允许链接标记 . This tutorial告诉你如何做到这一点 .

  • 1
    echo $post->post_excerpt; // this will return you the excerpt of the current post
    

相关问题