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

如何解决在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.csdn.net/weixin_42420249/article/details/81191861 依赖版本报错:更换其他版本 无法下载依赖可参考:https://blog.csdn.net/weixin_42628809/a
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下 2021-12-03 13:33:33.927 ERROR 7228 [ main] o.s.b.d.LoggingFailureAnalysisReporter : *************************** APPL
错误1:gradle项目控制台输出为乱码 # 解决方案:https://blog.csdn.net/weixin_43501566/article/details/112482302 # 在gradle-wrapper.properties 添加以下内容 org.gradle.jvmargs=-Df
错误还原:在查询的过程中,传入的workType为0时,该条件不起作用 &lt;select id=&quot;xxx&quot;&gt; SELECT di.id, di.name, di.work_type, di.updated... &lt;where&gt; &lt;if test=&qu
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct redisServer’没有名为‘server_cpulist’的成员 redisSetCpuAffinity(server.server_cpulist); ^ server.c: 在函数‘hasActiveC
解决方案1 1、改项目中.idea/workspace.xml配置文件,增加dynamic.classpath参数 2、搜索PropertiesComponent,添加如下 &lt;property name=&quot;dynamic.classpath&quot; value=&quot;tru
删除根组件app.vue中的默认代码后报错:Module Error (from ./node_modules/eslint-loader/index.js): 解决方案:关闭ESlint代码检测,在项目根目录创建vue.config.js,在文件中添加 module.exports = { lin
查看spark默认的python版本 [root@master day27]# pyspark /home/software/spark-2.3.4-bin-hadoop2.7/conf/spark-env.sh: line 2: /usr/local/hadoop/bin/hadoop: No s
使用本地python环境可以成功执行 import pandas as pd import matplotlib.pyplot as plt # 设置字体 plt.rcParams[&#39;font.sans-serif&#39;] = [&#39;SimHei&#39;] # 能正确显示负号 p
错误1:Request method ‘DELETE‘ not supported 错误还原:controller层有一个接口,访问该接口时报错:Request method ‘DELETE‘ not supported 错误原因:没有接收到前端传入的参数,修改为如下 参考 错误2:cannot r
错误1:启动docker镜像时报错:Error response from daemon: driver failed programming external connectivity on endpoint quirky_allen 解决方法:重启docker -&gt; systemctl r
错误1:private field ‘xxx‘ is never assigned 按Altʾnter快捷键,选择第2项 参考:https://blog.csdn.net/shi_hong_fei_hei/article/details/88814070 错误2:启动时报错,不能找到主启动类 #
报错如下,通过源不能下载,最后警告pip需升级版本 Requirement already satisfied: pip in c:\users\ychen\appdata\local\programs\python\python310\lib\site-packages (22.0.4) Coll
错误1:maven打包报错 错误还原:使用maven打包项目时报错如下 [ERROR] Failed to execute goal org.apache.maven.plugins:maven-resources-plugin:3.2.0:resources (default-resources)
错误1:服务调用时报错 服务消费者模块assess通过openFeign调用服务提供者模块hires 如下为服务提供者模块hires的控制层接口 @RestController @RequestMapping(&quot;/hires&quot;) public class FeignControl
错误1:运行项目后报如下错误 解决方案 报错2:Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project sb 解决方案:在pom.
参考 错误原因 过滤器或拦截器在生效时,redisTemplate还没有注入 解决方案:在注入容器时就生效 @Component //项目运行时就注入Spring容器 public class RedisBean { @Resource private RedisTemplate&lt;String
使用vite构建项目报错 C:\Users\ychen\work&gt;npm init @vitejs/app @vitejs/create-app is deprecated, use npm init vite instead C:\Users\ychen\AppData\Local\npm-