# Displaying expired job posts

To show expired job posts on your wordpress site you first need to define the number of expired job posts you want the API to fetch.&#x20;

{% hint style="info" %}
When allowing API to fetch expired job posts you might experience that an API call to our server takes longer time. The RecMan API will fetch all job posts ever existed, but the Bonsy API will reduce the list into the number of jobposts you have defined.
{% endhint %}

To show a feed of expired job posts, you only need to replace the `have_jobposts()` *method with* `have_expired_jobposts()`. Like this:

```php
<?php

# Check if there are any job posts available
if( have_expired_jobposts() ) :

     # loop through job posts
    while( have_expired_jobposts() ) : the_jobpost();

        # Print the job post title
        the_jobpost('title');

    endwhile;

else :

    echo "No job posts available.";

endif;

?>
```

#### Limit the number of job posts to display

You can also limit the feed by adding a count (integer) as the first parameter:

```php
if( have_expired_jobposts(10) ) :
    ....
```

#### Remember to reset the loop&#x20;

Remember that if you want to display multiple feeds on your WordPress site, you need to call the `reset_jobpost_loop()` method before adding a new loop.

```php
<?php

if( have_jobposts() ) :
    while( have_jobposts() ) : the_jobpost();
        the_jobpost('title');
    endwhile;
endif;

reset_jobpost_loop();

if( have_expired_jobposts() ) :
    while( have_expired_jobposts() ) : the_jobpost();
        the_jobpost('title');
    endwhile;
endif;

?>
```

{% hint style="warning" %}
**Limitation**

Expired job posts will not work with filtering and search. Also, methods like `get_jobpost_count()` doesn't count expired job posts. Permalinks does work.
{% endhint %}

{% hint style="info" %}
If you have activated the option to show single job post on your WordPress site you might consider using the field `isExpired` to check if the job post showing has expired. An expired job post will use the same template as an active job post when showing the job post page.&#x20;
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://bonsy.gitbook.io/bonsay-recman-wp/job-posts/displaying-expired-job-posts.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
