我在wp_login_form()功能的帮助下创建了登录模板.现在,如果用户输入了错误的密码或用户名,它将login=failed使用以下代码将参考页面重定向到相同的页面:
add_action( 'wp_login_failed', 'front_end_login_fail' );
function front_end_login_fail( $username ) {
$_SESSION['uname'] = $username;
// Getting URL of the login page
$referrer = $_SERVER['HTTP_REFERER'];
$login_failed_error_codes = array( 'empty_password', 'empty_email', 'invalid_email', 'invalidcombo', 'empty_username', 'invalid_username', 'incorrect_password' );
// if there's a valid referrer, and it's not the default log-in screen
if( !empty( $referrer ) && !strstr( $referrer,'wp-login' ) && !strstr( $referrer,'wp-admin' ) ) {
wp_redirect( get_permalink( 93 ) . "?login=failed" );
exit;
}
}
Run Code Online (Sandbox Code Playgroud)
现在这个功能正常,但现在按照wordpress功能提供如下:
1.如果用户输入真实 …
我正在研究新的自定义主题.我已经安装了woocommerce插件.我有来自xml文件的导入产品.我曾尝试测试评级功能.它的工作在wordpress默认主题twentytwelve,twentysixteen.等等,但当我切换到我的自定义主题.评论部分没有显示评级.
看看屏幕截图.评论部分只有textarea.
这是我的comments.php代码
<div class="comments">
<?php if (post_password_required()) : ?>
<p><?php _e( 'Post is password protected. Enter the password to view any comments.', 'html5blank' ); ?></p>
</div>
<?php return; endif; ?>
<?php if (have_comments()) : ?>
<h2><?php comments_number(); ?></h2>
<ul>
<?php wp_list_comments('type=comment&callback=html5blankcomments'); // Custom callback in functions.php ?>
</ul>
<?php elseif ( ! comments_open() && ! is_page() && post_type_supports( get_post_type(), 'comments' ) ) : ?>
<p><?php _e( 'Comments are closed here.', 'html5blank' ); ?></p>
<?php endif; ?>
<?php comment_form(); ?> …Run Code Online (Sandbox Code Playgroud) 我正在使用woocommerce api手动添加订单.
我手动订购了变体产品,它在管理端显示了良好的编辑订单页面.
现在,问题是使用polylang插件的网站.
在那,有两种语言.我可以用英语成功添加订单.
但是当我尝试用另一种语言(阿拉伯语)添加产品时.它以奇怪的文本格式返回一些订单详细信息.在我的API中它返回:
"product_variation_details": "%d8%a7%d9%84%d8%ad%d8%ac%d9%85: ????"
Run Code Online (Sandbox Code Playgroud)
我使用下面的代码来获取API中的订单详细信息:
$variation_id = $single_items['item_meta']['_variation_id'][0];
if ($variation_id != 0) {
$variation = wc_get_product($variation_id);
$product_variation_details = wc_get_formatted_variation($variation->get_variation_attributes(), true);
}
Run Code Online (Sandbox Code Playgroud)
我搜索了很多,但无法获得更好的解决方案.任何帮助都会受到影响.提前致谢.