Many years ago, when I wasn’t so professional in wordpress web design, I didn’t care about under construction page! But then I realized it is important to keep details secret in wordpress website design until everything is done. The under construction page does the job! So now I want to teach you how to have an under construction page wordpress without plugin. Of course, many plugins can help you to build an under-construction page. But why install another plugin? God! Here I am to save you! Stat with wpexpelor!
Under construction page wordpress without plugin: step by step
There are only 2 reasons for this! If you are going to learn how to create a under construction page wordpress without plugin in just these two cases:
- First, you are developing a new website, and the site is really under construction! Probably, it’s better to launch the website when it is completely developed.
- Second: The site has already launched before but now it is the time to do some refactors. (you are going to enhance UI, etc.)
Any way! It doesn’t really feel good for your users to see a half-build website full of errors! Don’t make my mistake! It is important to keep the procedure hidden until it’s done.
To build a under construction page wordpress without plugin follow the steps:
1.First you need to create an HTML page for the “coming soon” page on your website. You don’t need to code it at all! There are thousands of free html templates for the coming soon page, as well as some premium templates. Here, I offer this code for building the page. Create a file, name it: “maintenance.html,” and put this code in the file:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>COMING SOON</title>
</head>
<body>
<div style="text-align: center; padding: 50px;">
<h1>COMING SOON</h1>
<p>Website is under construction, we will launch it very soon.</p>
</div>
</body>
</html>
- After you create the “maintenance.html,” it is time to put it in your host. Upload the file here:
wp-content/themes/YourTheme
Note: “YourTheme” can change depending on your wordpress theme name.
- At last you have to edit “functions.php” to put this code on it:
// Set under construction page as the temporary homepage
function under_construction_homepage() {
if (!is_user_logged_in() && !is_admin() && !is_page()) {
include(get_stylesheet_directory() . '/maintenance.html');
exit();
}
}
add_action('template_redirect', 'under_construction_homepage');
Note: Before changing, make a backup from your website, and it’s better to implement the changes on the child theme. By doing so, after the theme update (from the creator), your changes won’t be discarded!
One may ask why the code I offered works.
By that code, we want to say if a user has the role “Administrator,” show the website details as usual; otherwise, show the “coming soon” page. Here is the result:
wpexpelor coming soon page
Conclusion
I recommend using the “coming soon” page until every single task in your website design project is done! It is professional and easy to build an under construction page wordpress without plugin. Note that you should omit the code in “functions.php” when you want to launch the website. Feel free to ask any questions below.