> For the complete documentation index, see [llms.txt](https://bonsy.gitbook.io/bonsay-recman-wp/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://bonsy.gitbook.io/bonsay-recman-wp/job-posts/displaying-fields.md).

# Displaying fields

To get or display a job post field inside the loop or in the individual job post page template, we have two simple functions: `get_jobpost()` and `the_jobpost()`.

## get\_jobpost('field')

Returns the value of a specific [field](/bonsay-recman-wp/job-posts/displaying-fields/untitled.md). Returns `false` if value is not found.

Intuitive and powerful, this function can be used to load the value of any field from any location.

### Parameters

```php
get_jobpost( $field, $job_post_id );
```

* `$field` *(string)* *(Required)*  The field name.
* `$job_post_id` *(Optional)* The job post ID. Defaults to the current post.

### Examples

#### Get a value from the current post

This example shows how to load the value of field ‘title’ from the current job post.

```php
$title = get_jobpost( 'title' );
```

{% hint style="info" %}
By current post we mean either inside of a [loop](/bonsay-recman-wp/job-posts/job-post-template-usage.md), or inside an [individual job post template](/bonsay-recman-wp/job-posts/display-individual-job-post.md).
{% endhint %}

#### Get a value from a specific post

This example shows how to load the value of field ‘title’ from the job post with ID = 24592.

```php
$title = get_jobpost( 'title', 24592 );
```

#### Check if value exists

This example shows how to check if a value exists for a field.

```php
$value = get_jobpost( 'title');
 
if( $value ) {
    echo $value;
} else {
    echo 'empty';
}
```

## the\_jobpost()

Displays the value of a specific field.

Intuitive and powerful, this function can be used to output the value of any field from any location. Please note that this function is the same as `echo get_jobpost()`.

### Parameters <a href="#parameters" id="parameters"></a>

```php
the_jobpost( $field, $job_post_id );
```

* `$field` *(string)* *(Required)* The field name.
* `$job_post_id` *(Optional)* The job post ID. Defaults to the current post.

### Examples

#### Display a value from the current post

This example shows how to display the value of field ‘title’ from the current job post.

```php
<h2><?php the_jobpost('title'); ?></h2>
```

#### Display a value from a specific post

This example shows how to display the value of field ‘title’ from the job post with ID = 123.

```php
<h2><?php the_jobpost('title', 123); ?></h2>
```

#### Check if value exists

This example shows how to check if a value exists for a field.

```php
<?php if( get_jobpost('title') ): ?>
    <h2><?php the_jobpost('title'); ?></h2>
<?php endif; ?>
```

But it is probably better to do something like this:

```php
<?php if( $title = get_jobpost('title') : ?>
    <h2><?php echo $title;?></h2>
<?php endif; ?>
```
