【发布时间】:2017-03-20 15:40:43
【问题描述】:
我是 Wordpress 的新手,所以请多多包涵。
我正在使用以下链接从 wordpress 页面导航到另一个页面:
<a href="<?php echo site_url(); ?>/wp-content/themes/woffice-child-theme/page-templates/loginF.php"><img src="./wp-content/themes/woffice-child-theme/page-templates/images/signin-btn.png"></a>
loginF.php 确实会加载,但是从页面中的任何位置我调用任何 wordpress 函数(如 home_url() 或 wp_login_form() )页面都会停止呈现。例如,如果我将 home_url() 放在页面的开头,那么我会在浏览器中得到一个空页面。为什么会这样?我是否以某种方式脱离了 wordpress 上下文?怎么办?
这里是 loginF.php:
<html>
<?php
$redirect_url = home_url();
?>
<head>
<title>Title</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" type="text/css" href="/wp-content/themes/woffice-child-theme/page-templates/style2.css">
<link href="https://fonts.googleapis.com/css?family=Lato:300,400,700" rel="stylesheet">
<link href='https://fonts.googleapis.com/css?family=Open+Sans:400,700,300' rel='stylesheet' type='text/css'>
</head>
<body>
<div class="frontpage-content">
<div class="front-wrap">
<br/>
<div class="new-login-logo text-center"><img src="/wp-content/themes/woffice-child-theme/page-templates/images/new-login-logo.png"></div>
<br/><br/>
<div class="frontpage-fields">
<input type="text" name="log" id="user" class="input" placeholder="Email Address">
<input type="password" name="pwd" id="pass" class="input" placeholder="Password">
</div>
<div class="forgot-password-new"><a href="#">Forgot your password?</a></div>
<br/>
<div class="text-center"><a href="#"><img src="./images/captcha-image.png"></a></div>
<br/>
<div class="text-center new-login-space"><a href="#"><img src="/wp-content/themes/woffice-child-theme/page-templates/images/new-login-btn.png"></a></div>
</div>
</div>
</body>
</html>
【问题讨论】: