我有两种不同的CPT:锦标赛和团队。
我在锦标赛模板上有一个提交按钮。
在锦标赛cpt中提交团队注册(带代谢箱或其他东西)
例如,我管理A队,想在锦标赛B上注册。有一个按钮叫做“注册”。
在锦标赛CPT中,球队名称保存在BO中。
在前端:锦标赛A列表=>TeamName注册。
请帮我解决这个问题。任何帮助都将不胜感激。
我有两种不同的CPT:锦标赛和团队。
我在锦标赛模板上有一个提交按钮。
在锦标赛cpt中提交团队注册(带代谢箱或其他东西)
例如,我管理A队,想在锦标赛B上注册。有一个按钮叫做“注册”。
在锦标赛CPT中,球队名称保存在BO中。
在前端:锦标赛A列表=>TeamName注册。
请帮我解决这个问题。任何帮助都将不胜感激。
类oArenaAddTeam{public function \\uu construct(){add\\u action(\'init\',[$this,\'addTeamTournament\');}
function addTeamTournament()
{
// add_action(\'add_meta_boxes\', \'addTeamTournament\');
// $post = get_post_type();
// echo \'you are here\';
$author_id = get_current_user_id();
$args = array(
\'author\' => $author_id,
\'post_type\' => \'team\',
\'order\' => -1
);
$user = get_posts($args);
// untill there i have the var dump ok with post author
// var_dump($user);
// exit;
if (isset($_POST[\'register-team-tournament\']))
{
echo \'there\';
function init_metabox_tournament()
{
add_meta_box(\'team_register_tournament\', \'\', \'team_register_tournament\', \'tournament\', \'normal\' );
}
function team_tournament($post)
{
// var_dump($post);
// die;
$team_tournament = get_post_meta($post->ID, \'_team_register_tournament\', true);
}
add_action(\'save_post\', \'save_metabox_tournament\');
function save_metabox_tournament($post_id)
{
if (isset($_POST[\'register-team-tournament\']))
{
update_post_meta($post_id, \'_team_register_tournament\', $user->post_title);
}
}
} else {
echo \'wrong\';
}
} }
<form action="add-team" method="post">
<input type="submit" value="S\'inscrire" name="register-team-tournament"">
</form>
提前感谢:D