'awsm_widget_recent_jobs', 'description' => esc_html__( 'Your site’s most recent Job listings.', 'wp-job-openings' ), 'customize_selective_refresh' => true, ); parent::__construct( 'awsm-recent-jobs', esc_html__( 'AWSM: Recent Jobs', 'wp-job-openings' ), $widget_ops ); } public function widget( $args, $instance ) { if ( ! isset( $args['widget_id'] ) ) { $args['widget_id'] = $this->id; } $title = ( ! empty( $instance['title'] ) ) ? $instance['title'] : __( 'Recent Jobs', 'wp-job-openings' ); $title = apply_filters( 'widget_title', $title, $instance, $this->id_base ); $default_num_jobs = get_option( 'awsm_jobs_list_per_page' ); $num_jobs = ( ! empty( $instance['number'] ) ) ? absint( $instance['number'] ) : $default_num_jobs; if ( ! $num_jobs ) { $num_jobs = $default_num_jobs; } $show_spec = isset( $instance['show_spec'] ) ? $instance['show_spec'] : true; $show_more = isset( $instance['show_more'] ) ? $instance['show_more'] : true; $query_args = apply_filters( 'awsm_widget_recent_jobs_args', array( 'post_type' => 'awsm_job_openings', 'posts_per_page' => $num_jobs, 'no_found_rows' => true, 'post_status' => 'publish', 'ignore_sticky_posts' => true, ), $instance ); $query = new WP_Query( $query_args ); if ( ! $query->have_posts() ) { return; } if ( ! function_exists( 'get_awsm_jobs_template_path' ) ) { return; } echo $args['before_widget']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped if ( $title ) { echo $args['before_title'] . esc_html( $title ) . $args['after_title']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped } do_action( 'before_awsm_recent_jobs_widget_content', $args, $instance ); include get_awsm_jobs_template_path( 'recent-jobs', 'widgets' ); do_action( 'after_awsm_recent_jobs_widget_content', $args, $instance ); echo $args['after_widget']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped } public function form( $instance ) { $title = isset( $instance['title'] ) ? esc_attr( $instance['title'] ) : ''; $num_jobs = isset( $instance['number'] ) ? $instance['number'] : get_option( 'awsm_jobs_list_per_page' ); $show_spec = isset( $instance['show_spec'] ) ? (bool) $instance['show_spec'] : true; $show_more = isset( $instance['show_more'] ) ? (bool) $instance['show_more'] : true; ?>

id="get_field_id( 'show_spec' ) ); ?>" name="get_field_name( 'show_spec' ) ); ?>" />

id="get_field_id( 'show_more' ) ); ?>" name="get_field_name( 'show_more' ) ); ?>" />