我有一个自定义模板。在其中,我想检查当前登录用户是否有名为(student\\u form)的自定义帖子,如果帖子等于true,我想将其重定向到其他页面,我想向他/她显示我使用wp fronted user创建的表单。
下面是我写的代码,但它显示的是空白页。
<?php
/*
* Template Name: Form Page
*/
get_header();
global $current_user=null;
get_currentuserinfo();
$args=array(
\'author\' => $current_user->ID,
\'post_type\' => \'student_form\',
\'caller_get_posts\'=> 1
);
$my_query = null;
$my_query = new WP_Query($args);
if( $my_query->have_posts() )
{
exit( wp_redirect(\'http://burjhuraira.com/orgibs/dashboard/\') );
}
else
{
echo do_shortcode(\'[wpuf_form id="414"]\');
}
wp_reset_query();
get_footer();
?>