Quantcast

How to get the single latest post with comments on homepage in wordpress

It is very common and easy to setup your wordpress site’s homepage with the latest post including comments on home page of your website.

Here is how you can do it.

No matter which wordpress theme you are using. All themes usually have single.php file in there. Simply copy the file and rename it to LatestPost.php

Now open that new file and add this code on very top of it.


The above code makes a page template in your theme. The name we assigned to this template is LatestPost, off course you can rename it to whatever you like.
Now find the below code in LatestPost.php file

The above code actually creates the template for comments and populates all comments submitted under the post.

So now, right above the code, put this code

So it should like the below code sample.

$withcomments =1; actually makes your homepage to accept comments and also it will list comments submitted so far on your post.

I hope this will be helpful for you people.

Looking for a quality hosting service? here are a few I suggest.
BlueHost | HostGator | Media Temple
Admin
Admin
Ali has been an entrepreneur in web, video and related technologies. Having worked with many business across the globe, Ali stands truly a great pillar in the business working with him.