Posted: 2 years ago
I found this useful if you just want to get a blog up and running and don’t want to worry about setting up a separate homepage (page). You can create one post and you’re good to go. It also means you don’t have to set up an archive (that might not look or behave like you want) or create a new page (and add content for it).
If you’re more of a hand’s on kind of WordPress user then see the code below. Just a quick snippet to allow you set a post as the homepage in WordPress.
Allow the user to select a post from the dropdown list, when selecting the static page in wp-admin:
Set the post type for the homepage to prevent redirects. This will also allow single.php to be used as the default template if the post type is ‘post’. This means we don’t have to explicitly set the post type and could be re-used for custom post types in the future. This works with WordPress’ template hierarchy so you can use front-page.php to override other template files for the homepage.