将WP Job Manager自定义字段显示在弹出窗口中

时间:2018-06-08 12:26:23

标签: php wordpress function

我正在使用WP作业管理器插件来允许在我的网站上提交应用程序。插件开发人员跟随official documentation我使用此功能创建了自定义电话字段:

// Add field to admin
add_filter( 'resume_manager_resume_fields', 'wpjms_admin_resume_form_fields' 
);
function wpjms_admin_resume_form_fields( $fields ) {

$fields['_candidate_color'] = array(
    'label'         => __( 'Phone', 'job_manager' ),
    'type'          => 'text',
    'placeholder'   => __( 'Enter your phone', 'job_manager' ),
    'description'   => '',
    'priority' => 1
);

return $fields;

}

// Add field to frontend
add_filter( 'submit_resume_form_fields', 'wpjms_frontend_resume_form_fields' 
);
function wpjms_frontend_resume_form_fields( $fields ) {

$fields['resume_fields']['phone'] = array(
    'label' => __( 'Phone', 'job_manager' ),
    'type' => 'text',
    'required' => true,
    'placeholder' => '',
    'priority' => 1
);

return $fields;

}

// Add a line to the notifcation email with custom field
add_filter( 'apply_with_resume_email_message', 
'wpjms_color_field_email_message', 10, 2 );
function wpjms_color_field_email_message( $message, $resume_id ) {
$message[] = "\n" . "Phone: " . get_post_meta( $resume_id, '_phone', true );  
return $message;
}

我尝试向前here显示绿色联系人弹出按钮,但似乎没有显示使用此代码的一些开发人员建议:

<?php echo get_post_meta( $post->ID, '_phone', true ); ?>

我尝试使用相同的代码显示到绿色弹出窗口,但它不起作用..电话插入该应用程序的管理区域,并在检查时显示。这就是弹出区域的样子:

<div class="resume_contact">

    <a href="#resume-dialog" class="small-dialog popup-with-zoom-anim button"><i class="fa fa-envelope"></i> <?php esc_html_e( 'Contact', 'workscout' ); ?></a>
    <div id="resume-dialog" class="small-dialog zoom-anim-dialog mfp-hide apply-popup">
        <div class="small-dialog-headline">
            <h2><?php esc_html_e('Send Message','workscout'); ?></h2>
        </div>
        <div class="small-dialog-content">
            <!--<?php do_action( 'resume_manager_contact_details' ); ?>--> // Need to show phone content here !
        </div>
    </div>
</div>

Ahy在这里帮忙怎么展示?

1 个答案:

答案 0 :(得分:0)

修正了我自己:)

问题出在这一部分:

add_filter( 'resume_manager_resume_fields', 'wpjms_admin_resume_form_fields' 
);
function wpjms_admin_resume_form_fields( $fields ) {

$fields['_candidate_color'] = array(  // Here i didnt renamed field to _phone  lol :D
'label'         => __( 'Phone', 'job_manager' ),
'type'          => 'text',
'placeholder'   => __( 'Enter your phone', 'job_manager' ),
'description'   => '',
'priority' => 1
);

return $fields;

}

现在工作正常。感谢任何人的帮助。