在wp-job Manager的顶级雇主工作清单上应用精选简历

问题描述

当前,我正在使用workcout wordpress主题和wp作业管理器插件。

我想要的是,当一个候选人通过其特色简历申请某项特定工作时....雇主(正在提供工作),当他看到来自所有不同候选人的所有应聘简历时,该特色简历将显示在然后一切正常恢复。

以下是我的代码:

/**
 * Add a new column to the job dashboard
 *
 * @param $columns array
 * @return array
 */
public function add_applications_columns( $columns ) {
    $columns['applications'] = __( 'Applications','wp-job-manager-applications' );
    return $columns;
}

/**
 * Show the count of applications in the job dashboard
 *
 * @param  WP_Post Job
 */
public function applications_column( $job ) {
    global $post;

    echo ( $count = get_job_application_count( $job->ID ) ) ? '<a href="' . add_query_arg(
        [
            'action' => 'show_applications','job_id' => $job->ID,],get_permalink( $post->ID )
    ) . '">' . $count . '</a>' : '&ndash;';
}

/**
 * Show applications on the job dashboard
 */
public function show_applications( $atts ) {
    $job_id = absint( $_REQUEST['job_id'] );
    $job    = get_post( $job_id );

    extract(
        shortcode_atts(
            [
                'posts_per_page' => '12','orderby'       => 'rand_featured',//this is i added
                'featured' => true,//this is i added

            ],$atts
        )
    );

    remove_filter( 'the_title',[ $this,'add_breadcrumb_to_the_title' ] );

    // Permissions
    if ( ! job_manager_user_can_edit_job( $job_id ) ) {
        _e( 'You do not have permission to view this job.','wp-job-manager-applications' );
        return;
    }

    wp_enqueue_script( 'wp-job-manager-applications-dashboard' );

    $args = apply_filters(
        'job_manager_job_applications_args',[
            'post_type'           => 'job_application','post_status'         => array_diff( array_merge( array_keys( get_job_application_statuses() ),[ 'publish' ] ),[ 'archived' ] ),'ignore_sticky_posts' => 1,'posts_per_page'      => $posts_per_page,'offset'              => ( max( 1,get_query_var( 'paged' ) ) - 1 ) * $posts_per_page,'post_parent'         => $job_id,'orderby'           => 'rand_featured',//this is i added
        ]
    );

    // Filters
    $application_status  = ! empty( $_GET['application_status'] ) ? sanitize_text_field( $_GET['application_status'] ) : '';
    $application_orderby = ! empty( $_GET['application_orderby'] ) ? sanitize_text_field( $_GET['application_orderby'] ) : '';

    if ( $application_status ) {
        $args['post_status'] = $application_status;
    }

    switch ( $application_orderby ) {
        case 'name':
            $args['order']   = 'ASC';
            $args['orderby'] = 'post_title';
            break;
        case 'rating':
            $args['order']    = 'DESC';
            $args['orderby']  = 'meta_value';
            $args['meta_key'] = '_rating';
            break;
        default:
            $args['order']   = 'ASC';
        //  $args['orderby'] = 'date'; //this is before
            $args['orderby'] = 'rand'; //this is i added
        //  $args['featured'] = true;   //this is i added

            break;
    }

    $applications = new WP_Query();

    $columns = apply_filters(
        'job_manager_job_applications_columns',[
            'name'  => __( 'Name','wp-job-manager-applications' ),'email' => __( 'Email','date'  => __( 'Date Received',]
    );

    get_job_manager_template(
        'job-applications.php',[
            'applications'        => $applications->query( $args ),'job_id'              => $job_id,'max_num_pages'       => $applications->max_num_pages,'columns'             => $columns,'application_status'  => $application_status,'application_orderby' => $application_orderby,'wp-job-manager-applications',JOB_MANAGER_APPLICATIONS_PLUGIN_DIR . '/templates/'
    );
}

/**
 * Add note via ajax
 */
public function add_job_application_note() {
    check_ajax_referer( 'job-application-notes','security' );

    $application_id = absint( $_POST['application_id'] );
    $application    = get_post( $application_id );
    $note           = wp_kses_post( trim( stripslashes( $_POST['note'] ) ) );

    if ( $application_id > 0 && $this->can_edit_application( $application_id ) ) {

        $user                 = get_user_by( 'id',get_current_user_id() );
        $comment_author       = $user->display_name;
        $comment_author_email = $user->user_email;
        $comment_post_ID      = $application_id;
        $comment_author_url   = '';
        $comment_content      = $note;
        $comment_agent        = 'WP Job Manager';
        $comment_type         = 'job_application_note';
        $comment_parent       = 0;
        $comment_approved     = 1;
        $commentdata          = apply_filters( 'job_application_note_data',compact( 'comment_post_ID','comment_author','comment_author_email','comment_author_url','comment_content','comment_agent','comment_type','comment_parent','comment_approved' ),$application_id );
        $comment_id           = wp_insert_comment( $commentdata );

        echo '<li rel="' . esc_attr( $comment_id ) . '" class="job-application-note"><div class="job-application-note-content">';
        echo wpautop( wptexturize( $note ) );
        echo '</div><p class="job-application-note-meta"><a href="#" class="delete_note">' . __( 'Delete note','wp-job-manager-applications' ) . '</a></p>';
        echo '</li>';
    }
    die();
}

/**
 * Delete note via ajax
 */
public function delete_job_application_note() {
    check_ajax_referer( 'job-application-notes','security' );

    if ( $note_id = absint( $_POST['note_id'] ) ) {
        $note           = get_comment( $note_id );
        $application_id = absint( $note->comment_post_ID );
        $application    = get_post( $application_id );
        if ( $application_id > 0 && $this->can_edit_application( $application_id ) ) {
            wp_delete_comment( $note_id );
        }
    }
    die();
}

/**
 * Exclude application comments from queries and RSS
 *
 * This code should exclude comments from queries. Some queries (like the recent comments widget on the dashboard) are hardcoded
 * and are not filtered,however,the code current_user_can( 'read_post',$comment->comment_post_ID ) should keep them safe.
 *
 * The frontend view order pages get around this filter by using remove_filter.
 *
 * @param array $clauses
 * @return array
 */
public static function exclude_application_comments( $clauses ) {
    global $wpdb,$typenow,$pagenow;

    if ( is_admin() && $typenow == 'job_application' ) {
        return $clauses;
    }

    if ( ! $clauses['join'] ) {
        $clauses['join'] = '';
    }

    if ( ! strstr( $clauses['join'],"JOIN $wpdb->posts" ) ) {
        $clauses['join'] .= " LEFT JOIN $wpdb->posts ON comment_post_ID = $wpdb->posts.ID ";
    }

    if ( $clauses['where'] ) {
        $clauses['where'] .= ' AND ';
    }

    $clauses['where'] .= " $wpdb->posts.post_type NOT IN ('job_application') ";

    return $clauses;
}

/**
 * Exclude comments from queries and RSS
 *
 * @param string $join
 * @return string
 */
public function exclude_application_comments_from_feed_join( $join ) {
    global $wpdb;

    if ( ! strstr( $join,$wpdb->posts ) ) {
        $join = " LEFT JOIN $wpdb->posts ON $wpdb->comments.comment_post_ID = $wpdb->posts.ID ";
    }

    return $join;
}

/**
 * Exclude order comments from queries and RSS
 *
 * @param string $where
 * @return string
 */
public function exclude_application_comments_from_feed_where( $where ) {
    global $wpdb;

    if ( $where ) {
        $where .= ' AND ';
    }

    $where .= " $wpdb->posts.post_type NOT IN ('job_application') ";

    return $where;
}
}
new WP_Job_Manager_Applications_Dashboard();

这是前面的html代码

<div class="sixteen columns alpha omega">
        
            <?php foreach ( $applications as $application ) :
             ?>
                <div class="application job-application" id="application-<?php echo esc_attr( $application->ID ); ?>">
                    <div class="app-content">
                        
                        <!-- Name / Avatar -->
                        <div class="info">
                            <?php echo get_job_application_avatar( $application->ID,90 ) ?>
                            <span><?php if ( ( $resume_id = get_job_application_resume_id( $application->ID ) ) && 'publish' === get_post_status( $resume_id ) && function_exists( 'get_resume_share_link' ) && ( $share_link = get_resume_share_link( $resume_id ) ) ) : ?>
                                <a href="<?php echo esc_attr( $share_link ); ?>"><?php echo $application->post_title; ?></a>
                                <?php else : ?>
                                    <?php echo $application->post_title; ?>
                                <?php endif; ?>
                            </span>
                            <ul>
                                <?php if ( $attachments = get_job_application_attachments( $application->ID ) ) : ?>
                                    <?php foreach ( $attachments as $attachment ) : ?>
                                        <li><a href="<?php echo esc_url( $attachment ); ?>" title="<?php echo esc_attr( get_job_application_attachment_name( $attachment ) ); ?>" class=" job-application-attachment"><i class="fa fa-file-text"></i> <?php echo esc_html( get_job_application_attachment_name( $attachment,15 ) ); ?></a></li>
                                    <?php endforeach; ?>
                                <?php endif; ?>
                                <?php if ( $email = get_job_application_email( $application->ID ) ) : ?>
                                    <li><a href="mailto:<?php echo esc_attr( $email ); ?>?subject=<?php echo esc_attr( sprintf( esc_html__( 'Your job application for %s','workscout' ),strip_tags( get_the_title( $job_id ) ) ) ); ?>&amp;body=<?php echo esc_attr( sprintf( esc_html__( 'Hello %s',get_the_title( $application->ID ) ) ); ?>" title="<?php esc_html_e( 'Email','workscout' ); ?>" class="bjob-application-contact"><i class="fa fa-envelope"></i>  <?php esc_html_e( 'Email','workscout' ); ?></a></li>
                                <?php endif; ?>
                                <?php 
                                if ( ( $resume_id = get_job_application_resume_id( $application->ID ) ) && 'publish' === get_post_status( $resume_id ) && function_exists( 'get_resume_share_link' ) && (
                                 $share_link = get_resume_share_link( $resume_id ) ) ) : ?>
                                    <li><a href="<?php echo esc_attr( $share_link ); ?>" target="_blank" class="job-application-resume">
                                    <i class="fa fa-download" aria-hidden="true"></i><?php esc_html_e('View Resume','workscout' ); ?></a></li>
                                <?php endif; ?>
                            </ul>
                        </div>

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

依赖报错 idea导入项目后依赖报错,解决方案:https://blog....
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下...
错误1:gradle项目控制台输出为乱码 # 解决方案:https://bl...
错误还原:在查询的过程中,传入的workType为0时,该条件不起...
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct...