How can I append this php link to the end of the e

2019-09-20 05:09发布

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>

1条回答
叼着烟拽天下
2楼-- · 2019-09-20 05:27

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 &raquo;' . '</a>';
   }
   add_filter('excerpt_more', 'new_excerpt_more');

remove the <a class="see_more" href="<?php the_permalink();?>">SEE MORE >></a> entirely.

查看更多
登录 后发表回答