WordPress.org

Ready to get started?Download WordPress

Forums

wp get recent posts limit char (1 post)

  1. cpedersen
    Member
    Posted 3 years ago #

    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..

    <?php
          $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?

Topic Closed

This topic has been closed to new replies.

About this Topic