我怎样才能将这个PHP链接追加到摘录的末尾? [英] How can I append this php link to the end of the excerpt?
本文介绍了我怎样才能将这个PHP链接追加到摘录的末尾?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何追加< a class =see_morehref =<?php the_permalink();?>>查看更多>>< / a> / code>部分到摘录结尾?
How can I append <a class="see_more" href="<?php the_permalink();?>">SEE MORE >></a>
part to the end of the excerpt?
<div class="item_content">
<h4><a href="<?php the_permalink();?>"><?php the_title();?></a></h4>
<?php
add_filter('excerpt_length', 'df_new_excerpt_length_30');
the_excerpt();
remove_filter('excerpt_length', 'df_new_excerpt_length_30');
?>
<a class="see_more" href="<?php the_permalink();?>">SEE MORE >></a>
</div>
推荐答案
确定找到了。首先打开你的functions.php文件,并将以下代码粘贴到php标签中:
OK found it. First open your functions.php file, and paste the following code inside the php tags:
// Changing excerpt more
function new_excerpt_more($more) {
global $post;
return '… <a href="'. get_permalink($post->ID) . '">' . 'Read More »' . '</a>';
}
add_filter('excerpt_more', 'new_excerpt_more');
移除< a class =see_morehref =< ?php the_permalink();?>>查看更多>>< / a
>完全。
这篇关于我怎样才能将这个PHP链接追加到摘录的末尾?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文