I am facing an issue while I upload the custom HTML page into my Wordpress site.
The page all alone working fine as I put it in separate folder or if I change its name to index.php
.
But then their arise a conflict between this custom page and the other WP theme pages .If I set this as a index.php
page in theme or root WP .This page runs swiftly but other theme pages doesn’t work .Just show the same index page but with broken css
So all I want is not to broke my theme page as well to set custom html page it as my default Home Page How can I achieve this ? I am using divi them
HTML page that I want to set as my Default Home page :
Rest of site :
I am facing an issue while I upload the custom HTML page into my Wordpress site.
The page all alone working fine as I put it in separate folder or if I change its name to index.php
.
But then their arise a conflict between this custom page and the other WP theme pages .If I set this as a index.php
page in theme or root WP .This page runs swiftly but other theme pages doesn’t work .Just show the same index page but with broken css
So all I want is not to broke my theme page as well to set custom html page it as my default Home Page How can I achieve this ? I am using divi them
HTML page that I want to set as my Default Home page : http://filmyoze/Default
Rest of site : http://filmyoze
This code may help resolve the issue for this particular situation. Put this code in yor theme's functions.php
.
add_action('template_redirect', 'default_page');
function default_page(){
if(is_home() or is_front_page()){
exit( wp_redirect("http://path/to/your/html/file"));
}
}
Replace http://path/to/your/html/file
to exact url of html file.
I hope this helps.
WordPress relies on all WordPress requests being routed to index.php, which kicks off the whole WordPress lifecycle and then serves up the proper page, content, etc. (This is true for everything except requests to other real, existing files, like images and external pages that don't need WordPress.)
If you want your custom page to be the home page of your site, but live within WordPress (which is usually the case), then you need to operate within WordPress's world. That means you don't just stick a file in your directory, and you certainly don't replace WordPress's index.php file.
Instead, you create a page template and a page within WordPress to use it. Basically:
With those steps, WordPress will capture all requests to your home page, and serve the page you created (in step 1) using the template you created (in steps 3 & 4). You can then go further and store front page content (i.e. content, meta data, etc.) on that WordPress page, and pull it into your page template dynamically.