Site logo

Archived topic

How to set latest blog post as front page

7 replies · Started by Tri Ryuzaki on December 13, 2021

Viewing posts 1–8 of 8

Hello, please instruct me to set a single blog post as homepage (front page) similar to this website: https://www.vpnmentor.com/. Thanks

Hi there,

believe it or not - its NOT actually possible with WordPress - you can only set a static Page ( or the latest posts ) on your home page.

There may be some bright spark on Stack Overflow that has a workaround but there is no official way to do this.

Hi there,

How do you know that site is using WordPress, as it looks to me, Not a WordPress site.

You can tell by the bodyelement, there's not single WordPress class in it.
https://www.screencast.com/t/ttUViJcmm6Ju

So you need to learn more, here are 4 ways to prove:

- Method 1: ctrl + shift + I --> search for "theme", result below:
https://imgur.com/89zhMyn

- Method 2: Use wordpress checking site: https://www.isitwp.com/, result below
https://imgur.com/dyqcu9h

- Method 3: Ctrl + U (View page source), you can see a lot of "wp-content":
https://imgur.com/kjDElXl

- Method 4: Just go to: https://www.vpnmentor.com/wp-admin

Happy now? Btw your statement does not help solve the case in any way

Hi there,

This is possible but only through a hacky way w/ snippets or through child theme templating.

You can set the homepage as the default blog page and then set the post per page to 1. This technically displays a post on the home page but this doesn't literally make the single post page THE home page.

Alternative #2 is by doing a template redirect like here:
https://bavotasan.com/2015/single-post-as-home-page-in-wordpress/#:~:text=Redirect%20the%20template

But again, what this does is it redirect the visitors from the actual front page to a post. This doesn't make a post THE front page.

Alternative #3 is, you can write your own front-page.php on a child theme to contain a query for just 1 post.
It's similar to #1 and I think this is what your reference site is doing because the page itself is a bit broken because if you inspect, all the usual parts generated by WordPress are missing. (body tags having empty classes)

Alternative #4 is through plugins like this - https://wordpress.org/plugins/mpress-custom-front-page/ which employs the same idea I've mentioned in #2 if you look at its codes - https://github.com/wpscholar-wp-plugins/mpress-custom-front-page/blob/master/mpress-custom-front-page.php

Note: This particular issue is with WordPress core itself rather than the theme's. A theme can only follow what the core does. The rest are niches and this particular one is very rare to include as a feature request. It's also out of scope as it's a custom development not just of the theme's but WordPress default behavior itself.

Hi Elvin, thank you very much for your helpful & relevant reply, I'll definitely try them all.

You can find more variation of this if you search the web.

All of them mostly employ similar logic. You just need to find the one that fits what you exactly need.

No problem. :D

This archived topic is closed to new replies.