• Hello friends,
    I am stuck with a problem and need your help.
    I am using the default twenty ten theme with default excerpt length which is 40 … i am happy with that for my blog page. But I wish to display 3 most recent posts in my sidebar, for which i used the plugin “Recent Posts with Excerpts” but the problem is i am unable to change the expert length for my sidebar and also unable to add the “Read more” link like i did in my blog page.

    I will be very thankful for your help.

Viewing 1 replies (of 1 total)
  • Thread Starter czonex

    (@czonex)

    i used the following code and it works fine on my local server but gives an error on my hosting server …. using the same WP version on both places

    function custom_excerpt($new_length = 20, $new_more = '...') {
      add_filter('excerpt_length', function () use ($new_length) {
        return $new_length;
      }, 999);
      add_filter('excerpt_more', function () use ($new_more) {
        return $new_more;
      });
      $output = get_the_excerpt();
      $output = apply_filters('wptexturize', $output);
      $output = apply_filters('convert_chars', $output);
      $output = '<p>' . $output . '</p>';
      echo $output;
    }
Viewing 1 replies (of 1 total)

The topic ‘Multiple Excerpt Length’ is closed to new replies.