Isador Akios
Isador Akios

Reputation: 13

Making a custom html page work outside of theme in wordpress

So, i have an entire website built aroud Nikkon theme, and i have a landing page made with html/css. My problem is: if i copy the entire thing (both css and html) on a wp page, it gets weird because of all the theme's stuff. What i want to do is to have my custom page as landing page that can then redirect people to my actual homepage.

In order to do so, i tried using HTML pages plugin, which worked in importing the page, fully working, on wp. Now the problem is: my wp won't let me use anything that i upload to HTML pages as an home page (i guess it's because the page is missing all that get_header() stuff). I've always worked with WP OR html/css, never put the 2 together. Would be awesome if anyone had any tips.

Upvotes: 0

Views: 1285

Answers (2)

Shakeel Ahmad
Shakeel Ahmad

Reputation: 349

You can do it by three ways,

1 Make a wordpress template and add all the code to that template (you will need to assign this template to wordpress page from wp-admin). 2 Make a page in wordpress let say mypage.php and add all code to it ( you will need to just create page in wordpress with same name as the mypage.php name )

3 you need to make a directory in wordpress main directory where wp-admin/wp-include directory were place, add folder like mypage and in folder make index.php file.

these all three conditions will work

Upvotes: 0

Webfeya
Webfeya

Reputation: 313

You don't need any plugin for this landing page. Just create a file for example "landing.php" in your theme folder (wp-content/themes/themename/landing.php)

Put your default header:

<?php
/**
 * Template Name: Landing
 */

get_header(); ?>

    any html 

   <?php
      the_content();
    ?>

</body>
</html>

or create your own, if you need to use custom style.css file:


<?php
/**
 * Template Name: Landing
 */
 ?>
<!DOCTYPE html>
<html>
  <head>
    <title>Title</title>
    <meta name="viewport" content="width=device-width">
    <link rel="stylesheet" href="<?php echo esc_url( get_template_directory_uri() ); ?>/css/custom.css">
  </head>
    <body>
       
    any html

    <?php
        the_content();
    ?>

    </body>
</html>

Then you need just to select this template on your page in wp-admin:

enter image description here

Upvotes: 1

Related Questions