简体   繁体   中英

How can I append this php link to the end of the excerpt?

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>

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM