Support » Fixing WordPress » To display post with limited character on home page

  • Resolved @Raj

    (@rajeshtandonrocketmailcom)


    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; ?>

Viewing 1 replies (of 1 total)
  • Hi.
    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.
    Cheers!

Viewing 1 replies (of 1 total)
  • The topic ‘To display post with limited character on home page’ is closed to new replies.