# Adding Fields and Tiles.

## Adding a field to track

You need tell Disciple.tools that you want to track something new. Fields are defined in the theme’s custom post type file. And we give you a way to add to that list using the dt\_custom\_fields\_settings filter.

Here is an example on how to add a spoken language field on the contact:

```php
add_filter( "dt_custom_fields_settings", "dt_contact_fields", 1, 2 );
function dt_contact_fields( array $fields, string $post_type = ""){
    //check if we are dealing with a contact
    if ($post_type === "contacts"){
        //check if the language field is already set
        if ( !isset( $fields["language"] )){
            //define the language field
            $fields["language"] = [
                "name" => __( "Spoken Language", "disciple_tools_language" ),
                "type" => "key_select",
                "default" => [
                    "english" => __( "English", "disciple_tools_language" ),
                    "french" => __( "French", "disciple_tools_language" )
                ],
                "tile" => "contact_language"
            ];
        }
    }
    //don't forget to return the update fields array
    return $fields;
}
```

See [Field Options](/theme-core/customization/fields.md) for documentation on field types.

## Adding a Tile

```php
add_filter( 'dt_details_additional_tiles', 'dt_details_additional_tiles', 10, 2 );
public function dt_details_additional_tiles( $tiles, $post_type = "" ){
    if ( $post_type === "contacts" ){
        $tiles["contact_language"] = [ "label" => __( "Language", 'disciple_tools' ) ];
    }
    return $tiles;
}
```

Since the language field is already declared in the fields list with the "contact\_language" tile, D.T will take care of displaying the field.

## Add custom content

If you desire to display a field or element your own way you can also do so: Change the filter priority to determine the order of this code

```php
add_action( "dt_details_additional_section", "dt_add_section", 30, 2 );
function dt_add_section( $section, $post_type ) {
    if ( $section === "contact_language" && $post_type === "contacts" ) {
        ?>
        <!-- need you own css? -->
        <style type="text/css">
            .required-style-example {
                color: red
            }
        </style>

        <p class="required-style-example"> Wanna know something cool? D.T is translated into multiple languages. <a href="https://disciple.tools/translation/">Check it out!</a></p>

        <script type="application/javascript">
            //enter jquery here if you need it
            jQuery(($) => {
            })
        </script>
        <?php
    }
}
```

## End result

![End result](/files/vIk35SsJpWCiAK6ioO0f)


---

# 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://developers.disciple.tools/theme-core/customization/field-and-tiles.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.
