1

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.com/Default

Rest of site : http://filmyoze.com

2

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.

3

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:

  1. Create a page in WordPress
  2. On your WordPress dashboard, go to Settings -> Reading and for Front Page choose the page you created
  3. In your site's directory, name your file front-page.php
  4. In front-page.php, at a minimum, put the PHP calls to get_header() before your content, and get_footer() after your content

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.