[英]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.因此,我有一个围绕 Nikkon 主题构建的整个网站,并且我有一个使用 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.
我的问题是:如果我在 wp 页面上复制整个内容(css 和 html),由于所有主题的内容,它会变得很奇怪。 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.为了做到这一点,我尝试使用 HTML 页面插件,该插件可以在 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).
现在的问题是:我的 wp 不允许我使用我上传到 HTML 页面的任何内容作为主页(我想这是因为该页面缺少所有 get_header() 内容)。 I've always worked with WP OR html/css, never put the 2 together.
我一直使用 WP OR html/css,从来没有把 2 放在一起。 Would be awesome if anyone had any tips.
如果有人有任何提示,那就太棒了。
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)
只需在主题文件夹(wp-content/themes/themename/landing.php)中创建一个文件,例如“landing.php”
Put your default header:把你的默认 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:或创建自己的,如果您需要使用自定义 style.css 文件:
<?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:然后你只需要在你的 wp-admin 页面上 select 这个模板:
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). 1 制作一个 wordpress 模板并将所有代码添加到该模板(您需要将此模板分配给来自 wp-admin 的 wordpress 页面)。 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 )
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. 3 您需要在 wordpress 主目录中创建一个目录,其中 wp-admin/wp-include 目录所在的位置,添加 mypage 之类的文件夹并在文件夹中制作 index.php 文件。
these all three conditions will work这三个条件都行
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.