WordPress:如何创建一个自定义.php页面,其中包含另一个.php文件链接?

时间:2018-06-09 11:46:50

标签: php wordpress custom-wordpress-pages

我试图在WordPress中创建一个自定义页面我做了一些研究,你需要做的是在主题文件夹中创建一个包含这段代码的.php文件:

<?php /* Template Name: login */ ?>

这一个php文件,你把这个鳕鱼包含在工作中很棒,但在我的情况下它是一个注册表单,它确实有一个链接到另一个.php文件,这是register.php,当我尝试去那个链接时它会说:“这个页面似乎不存在”,即使两个.php文件都在同一目录中,我甚至试图在链接中包含完整路径不起作用我的完整login.php文件是这样的:

<?php include('server.php') /* Template name: login*/ ?>

<!DOCTYPE html>
<html>
<head>
    <title>login</title>
    <link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
    <div class="header">
        <h2>Login</h2>
    </div>

    <form method="post" action="login.php">

        <?php include('errors.php'); ?>

        <div class="input-group">
            <label>Username</label>
            <input type="text" name="username" >
        </div>
        <div class="input-group">
            <label>Password</label>
            <input type="password" name="password">
        </div>
        <div class="input-group">
            <button type="submit" class="btn" name="login_user">Login</button>
        </div>
        <p>
            Not yet a member? <a href="register.php">Sign up</a><!-- problem is here -->
        </p>
    </form>
</body>
</html>

当我点击注册时,它会转到:http://localhost/wordpress/login/register.php(页面的登录标题)并说它不存在 而不是在同一目录中打开register.php文件

0 个答案:

没有答案