【问题标题】:How can I append this php link to the end of the excerpt?如何将此 php 链接附加到摘录的末尾?
【发布时间】:2015-09-15 09:10:26
【问题描述】:

如何将<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>

【问题讨论】:

    标签: php html wordpress


    【解决方案1】:

    好的,找到了。首先打开你的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');
    

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

    【讨论】:

      猜你喜欢
      • 2012-09-12
      • 2014-08-21
      • 2012-02-23
      • 1970-01-01
      • 2017-07-10
      • 2015-03-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多