有人知道我在这里做错了吗?我在Wordpress子主题中的functions.php文件中有此代码。
<?php
function my_password_form() {
global $post;
$label = 'pwbox-'.( empty( $post->ID ) ? rand() : $post->ID );
$o = '<form action="' . esc_url( site_url( 'wp-login.php?action=postpass', 'login_post' ) ) . '" method="post">
' . __( "This content is CLASSIFIED, for subscribers only! To get access, <a href="http://maryefern.com/join">join here</a>, check your e-mail for a message from me with the password, and enter it below:" ) . '
<label for="' . $label . '">' . __( "Password:" ) . ' </label><input name="post_password" id="' . $label . '" type="password" size="20" maxlength="20" /><input type="submit" name="Submit" value="' . esc_attr__( "Submit" ) . '" />
</form>
';
return $o;
}
add_filter( 'the_password_form', 'my_password_form' );
?>
该错误通常表示您有一些不应包含的文本(字符串)。当我收到此错误时,这意味着我可能没有正确地转义过某些内容,或者没有正确地“跳入” php。
为了最大程度地减少这种情况,我将标记/输出分成不同的行。当然,它可以使代码更长(更多行),但只会使事情变得直截了当。
我不知道此代码是否有效,但至少您的错误已消失。@ceejayoz是正确的,语法突出显示应该可以在这里为您提供帮助。
的PHP
function my_password_form() {
global $post;
$label = 'pwbox-' . ( empty($post->ID) ? rand() : $post->ID );
$o = '<form action="' . esc_url(site_url('wp-login.php?action=postpass', 'login_post')) . '" method="post">';
$o .= '(This content is CLASSIFIED, for subscribers only! To get access, <a href="http://maryefern.com/join">join here</a>, check your e-mail for a message from me with the password, and enter it below:)';
$o .= '<label for="' . $label . '">' . ( "Password:" ) . '</label>';
$o .= '<input name = "post_password" id = "' . $label . '" type = "password" size = "20" maxlength = "20" /><input type = "submit" name = "Submit" value = "' . esc_attr__( "Submit" ) . '" />';
$o .= '</form>';
return $o;
}
add_filter('the_password_form', 'my_password_form');
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句