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

    (@ropol)

    I resolved it myself.

    function excerpt($post_id) {
      global $post;
      $save_post = $post;
      $post = get_post($post_id);
      $output = get_the_excerpt();
      $post = $save_post;
      return $output;
    }

    where $wppost is the argument for $post_id.

    If you want to trim it you can use wp_trim_words like this:
    wp_trim_words(excerpt($wppost), 10).

    This is added to: $list .= apply_filters……

    Hope this is helping someone.

Viewing 1 replies (of 1 total)

The topic ‘Adding excerpts to analytics top posts widget.’ is closed to new replies.