[resolved] To display post with limited character on home page (2 posts)

  1. @Raj
    Posted 3 years ago #

    Hi everyone,
    I want to display post on home page with only few words there, if anyone wants to read it more then he/she can click to read more button, but the problem is that i am not able do display a small post my code is displaying the full post which is looking very worst there. please if anybody have an idea please let me know.....
    code that i am using;

    <?php $my_postid = 27;
                            $content_post = get_post($my_postid);
                            $content = $content_post->post_content;
                           	echo $content; ?>
  2. Marventus
    Posted 3 years ago #

    You would need to use the_excerpt() function for that from your index.php file, which controls the layout of your home/front page.
    More info here.

Topic Closed

This topic has been closed to new replies.

About this Topic