Expired Job Posts
You can display recently expired job posts alongside or separately from active ones.
Configuration
Section titled “Configuration”First, configure how many expired job posts the API should fetch. This is set in the plugin’s fetch settings (stored on the Bonsy server). Contact Bonsy or use the admin dashboard to set the number of expired jobs to retain.
Display Expired Jobs
Section titled “Display Expired Jobs”Use the have_expired_jobposts() function instead of have_jobposts():
<?php if (have_expired_jobposts()): ?>
<?php while (have_expired_jobposts()): the_jobpost(); ?> <div class="expired-job"> <h3><?php the_jobpost('title'); ?></h3> <p><?php the_jobpost('excerpt'); ?></p> </div> <?php endwhile; ?>
<?php else: ?> <p>No expired job posts.</p><?php endif; ?>Limit the Count
Section titled “Limit the Count”Pass an integer to limit how many expired jobs are shown:
<?php if (have_expired_jobposts(10)): ?> <!-- Shows max 10 expired jobs --><?php endif; ?>Show Both Active and Expired Jobs
Section titled “Show Both Active and Expired Jobs”When showing both feeds on the same page, call reset_jobpost_loop() between them:
<?php// Active jobsif (have_jobposts()): while (have_jobposts()): the_jobpost(); the_jobpost('title'); endwhile;endif;
// Reset the loop before starting a new onereset_jobpost_loop();
// Expired jobsif (have_expired_jobposts()): echo '<h2>Previously Listed Positions</h2>'; while (have_expired_jobposts()): the_jobpost(); the_jobpost('title'); endwhile;endif;?>