Support » Fixing WordPress » wp get recent posts limit char

  • cpedersen


    Hello I’m trying to make wp get_recent_posts to have a max limit of char, but I can’t get it to work..

          $number_recents_posts = 1;//Can be how much you want
          $recent_posts = wp_get_recent_posts( $number_recents_posts );
          foreach($recent_posts as $post){
            echo '<a href="' . get_permalink($post["ID"]) . '" title="Link til '.$post["post_title"].'" >' .   $post
    ["post_content"].'</a>'; }

    I want [“post_content”] to have have limit on how many char and then a Read more or just “…”

    Anyone that can help me?

  • The topic ‘wp get recent posts limit char’ is closed to new replies.