preg_index( 1 ) . '&ai_job_listing_segments=' . $wpjob_list_rewrite->preg_index( 2 );
$wpjob_list_rewrite->rules = $new_rules + $wpjob_list_rewrite->rules;
}
/**
* Render the job listing page with custom content.
*
* This function replaces the default content of the job listing page with a custom HTML container and updates the page.
* It injects a `div` with a base permalink attribute for use in JavaScript applications.
*
* @since 1.0.0
*
* @param string $contents The original content of the job listing page.
* @return string The modified content containing the custom HTML structure.
*/
public function renderJobListingPage($contents)
{
$page_id = (int) get_option(self::PREFIX . 'career_page');
// Check if the current page is the career page
if (get_the_ID() !== $page_id) {
return $contents;
}
// Retrieve the base path for the page
$base_path = get_post_field('post_name', $page_id);
// Ensure the page ID is set and matches the current page
if (!$base_path) {
return $contents;
}
// Updated content with sanitized and escaped values
$updated_content = '';
// Update the post content securely
wp_update_post([
'ID' => $page_id,
'post_content' => $updated_content,
]);
return $updated_content;
}
}