Skip to content

Commit

Permalink
FIX: Struture breaks when job listing shortcode in grid style in job …
Browse files Browse the repository at this point in the history
…detail page
  • Loading branch information
nithinjohn22 committed Feb 5, 2024
1 parent 125f9ae commit c11fef9
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 18 deletions.
13 changes: 0 additions & 13 deletions inc/class-awsm-job-openings-core.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,6 @@ public function register_post_types() {
return;
}

$args['post_type'] = 'awsm_job_application';
$args['numberposts'] = -1;
$args['post_status'] = 'publish';
$application_count = count( get_posts( $args ) );

$labels = array(
'name' => __( 'Applications', 'wp-job-openings' ),
'singular_name' => __( 'Application', 'wp-job-openings' ),
Expand All @@ -130,14 +125,6 @@ public function register_post_types() {
'search_items' => __( 'Search Applications', 'wp-job-openings' ),
'not_found' => __( 'No Applications found', 'wp-job-openings' ),
'not_found_in_trash' => __( 'No Applications found in Trash', 'wp-job-openings' ),
'all_items' => $application_count
? sprintf(
/* translators: Number of applications */
__( 'Applications %s', 'wp-job-openings' ),
'<span class="awaiting-mod">' . $application_count . '</span>'
)
: __( 'Applications', 'wp-job-openings' ),

);

/**
Expand Down
4 changes: 2 additions & 2 deletions inc/template-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,8 @@ function awsm_job_spec_content( $pos ) {
}

if ( ! function_exists( 'awsm_job_listing_spec_content' ) ) {
function awsm_job_listing_spec_content( $job_id, $awsm_filters, $listing_specs ) {
echo AWSM_Job_Openings::get_specifications_content( $job_id, false, $awsm_filters, array( 'specs' => $listing_specs ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
function awsm_job_listing_spec_content( $job_id, $awsm_filters, $listing_specs, $has_term_link = true ) {
echo AWSM_Job_Openings::get_specifications_content( $job_id, false, $awsm_filters, array( 'specs' => $listing_specs ), $has_term_link ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
}

Expand Down
2 changes: 1 addition & 1 deletion inc/templates/job-openings/main.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@

do_action_deprecated( 'before_awsm_jobs_listing_right_col_content', array( $job_details['id'], $shortcode_atts ), '3.0.0', 'before_awsm_jobs_listing_specs_content' );

awsm_job_listing_spec_content( $job_details['id'], $awsm_filters, $listing_specs );
awsm_job_listing_spec_content( $job_details['id'], $awsm_filters, $listing_specs, false );

awsm_job_more_details( $job_details['permalink'], $view );

Expand Down
4 changes: 2 additions & 2 deletions wp-job-openings.php
Original file line number Diff line number Diff line change
Expand Up @@ -1652,7 +1652,7 @@ public static function get_job_expiry_details( $post_id, $post_status ) {
return apply_filters( 'awsm_job_expiry_details_content', $content );
}

public static function get_specifications_content( $post_id, $display_label, $filter_data = array(), $listing_specs = array() ) {
public static function get_specifications_content( $post_id, $display_label, $filter_data = array(), $listing_specs = array(), $has_term_link = true ) {
$spec_content = '';
$filter_data = ! empty( $filter_data ) ? $filter_data : get_option( 'awsm_jobs_filter' );
if ( ! empty( $filter_data ) ) {
Expand Down Expand Up @@ -1701,7 +1701,7 @@ public static function get_specifications_content( $post_id, $display_label, $fi
}
foreach ( $terms as $term ) {
$term_link = get_term_link( $term );
if ( ! is_singular( 'awsm_job_openings' ) || $is_specs_clickable !== 'make_clickable' || is_wp_error( $term_link ) ) {
if ( ! is_singular( 'awsm_job_openings' ) || $is_specs_clickable !== 'make_clickable' || is_wp_error( $term_link ) || ! $has_term_link ) {
$spec_terms .= '<span class="awsm-job-specification-term">' . esc_html( $term->name ) . '</span> ';
} else {
$spec_terms .= sprintf( '<a href="%2$s" class="awsm-job-specification-term">%1$s</a> ', esc_html( $term->name ), esc_url( $term_link ) );
Expand Down

0 comments on commit c11fef9

Please sign in to comment.