也许尝试这样的事情:
add_filter( 'gform_progress_bar', 'custom_progress_bar', 10, 3 );
function custom_progress_bar( $progress_bar, $form, $confirmation_message ) {
$current_page = GFFormDisplay::get_current_page( $form['id'] );
if($current_page == 1) {
$progress_bar = '<img src="path/to/image">';
} else if($current_page == 2){
$progress_bar = '<img src="path/to/image">';
} else if($current_page == 3){
$progress_bar = '<img src="path/to/image">';
} else if($current_page == 4){
$progress_bar = '<img src="path/to/image">';
} else if($current_page == 5){
$progress_bar = '<img src="path/to/image">';
}
return $progress_bar;
}
下面提供的示例代码是我过去只在第一页上隐藏进度条,但在其余页面上显示的代码。我相信您应该能够为每个页面返回您的步骤图像:
add_filter( 'gform_progress_bar', 'hide_progress_bar_wrap', 10, 3 );
function hide_progress_bar_wrap( $progress_bar, $form, $confirmation_message ) {
$current_page = GFFormDisplay::get_current_page( $form['id'] );
if($current_page == 1) {
$progress_bar = '<span class="wrap_progress_bar" style="visibility:hidden;display:none">'.$progress_bar.'</span>';
}
return $progress_bar;
}
希望它有效!