如何将这个php链接附加到摘录的末尾?

时间:2015-06-29 01:41:47

标签: php html wordpress

如何将<a class="see_more" href="<?php the_permalink();?>">SEE MORE >></a>部分附加到摘录的末尾?

 <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>

1 个答案:

答案 0 :(得分:0)

确定找到了。首先打开你的functions.php文件,然后将以下代码粘贴到php标签中:

// Changing excerpt more
   function new_excerpt_more($more) {
   global $post;
   return '… <a href="'. get_permalink($post->ID) . '">' . 'Read More &raquo;' . '</a>';
   }
   add_filter('excerpt_more', 'new_excerpt_more');

删除<a class="see_more" href="<?php the_permalink();?>">SEE MORE >></a&gt;完全。

相关问题