diff --git a/functions.php b/functions.php index e814a22..fa7d513 100644 --- a/functions.php +++ b/functions.php @@ -9,4 +9,9 @@ function chinese_excerpt($text, $lenth=40) { function new_excerpt_more($excerpt) { return ""; } - add_filter("excerpt_more", "new_excerpt_more"); \ No newline at end of file + add_filter("excerpt_more", "new_excerpt_more"); + //自定义截断函数 + function dm_strimwidth($str ,$start , $width ,$trimmarker ){ + $output = preg_replace('/^(?:[\x00-\x7F]|[\xC0-\xFF][\x80-\xBF]+){0,'.$start.'}((?:[\x00-\x7F]|[\xC0-\xFF][\x80-\xBF]+){0,'.$width.'}).*/s','\1',$str); + return $output.$trimmarker; + } \ No newline at end of file diff --git a/index.php b/index.php index 7f55403..50f05e2 100644 --- a/index.php +++ b/index.php @@ -110,7 +110,7 @@ $query = new WP_Query("posts_per_page=5&category_name=".$cat_name); while($query->have_posts()): $query->the_post(); ?> -
  • +
  • @@ -151,7 +151,7 @@ $query = new WP_Query("posts_per_page=5&category_name=".$cat_name); while($query->have_posts()): $query->the_post(); ?> -
  • +
  • @@ -206,7 +206,7 @@ while($query->have_posts()): $query->the_post(); ?> - + 更多>> @@ -231,7 +231,7 @@ $query = new WP_Query("posts_per_page=4&category_name=".$cat_name); while($query->have_posts()): $query->the_post(); ?> -
  • +
  • @@ -253,7 +253,7 @@ $query = new WP_Query("posts_per_page=6&category_name=".$cat_name); while($query->have_posts()): $query->the_post(); ?> -
  • +
  • @@ -278,7 +278,7 @@ $query = new WP_Query("posts_per_page=5&category_name=".$cat_name); while($query->have_posts()): $query->the_post(); ?> -
  • +
  • @@ -289,7 +289,7 @@ $query = new WP_Query("posts_per_page=5&category_name=".$cat_name); while($query->have_posts()): $query->the_post(); ?> -
  • +
  • @@ -312,7 +312,7 @@ $query = new WP_Query("posts_per_page=5&category_name=".$cat_name); while($query->have_posts()): $query->the_post(); ?> -
  • +
  • @@ -323,7 +323,7 @@ $query = new WP_Query("posts_per_page=5&category_name=".$cat_name); while($query->have_posts()): $query->the_post(); ?> -
  • +
  • @@ -368,7 +368,7 @@ $query = new WP_Query("posts_per_page=6&category_name=".$cat_name); while($query->have_posts()): $query->the_post(); ?> -
  • +