> ## Documentation Index
> Fetch the complete documentation index at: https://docs.chipmunktheme.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Filters

> Modify theme functionality with our custom hooks.

WordPress allows theme developers to make their themes customizable through advanced PHP solution called hooks. There are 2 types of hooks: **actions** and **filters**. Chipmunk uses filter functionality to allow advanced users to modify some parts of the theme.

<Info>
  To be able to use our custom filters, you’ll need to create a child theme or use our example child theme available to download [here](https://chipmunktheme.com/child-theme).
</Info>

## Add custom Google Fonts

`chipmunk_google_fonts`

```php functions.php theme={null}
function chipmunk_custom_google_fonts($fonts)
{
  $custom_fonts = [
    "Open Sans Condensed" => "Open Sans Condensed",
    "Merriweather" => "Merriweather",
  ];

  return array_merge($fonts, $custom_fonts);
}

add_filter("chipmunk_google_fonts", "chipmunk_custom_google_fonts");
```

## Add custom social profiles

`chipmunk_socials`

```php functions.php theme={null}
function chipmunk_custom_socials($socials)
{
  $custom_socials = ["Digg"];

  return array_merge($socials, $custom_socials);
}

add_filter("chipmunk_socials", "chipmunk_custom_socials");
```

## Change tile excerpt length

`chipmunk_{type}_excerpt_length`

Replace `{type}` with either `post`, `resource` or `collection`.

```php functions.php theme={null}
function chipmunk_excerpt_length()
{
  return 20;
}
add_filter("chipmunk_post_excerpt_length", "chipmunk_excerpt_length");
add_filter("chipmunk_resource_excerpt_length", "chipmunk_excerpt_length");
add_filter("chipmunk_collection_excerpt_length", "chipmunk_excerpt_length");
```

## Re-order or remove resource tabs

`chipmunk_resource_tabs`

```php functions.php theme={null}
// Re-order the resource tabs
function chipmunk_reorder_resource_tabs()
{
  return ["popular", "latest", "featured"];
}
add_filter("chipmunk_resource_tabs", "chipmunk_reorder_resource_tabs");

// Remove the resource tabs completely
function chipmunk_remove_resource_tabs()
{
  return [];
}
add_filter("chipmunk_resource_tabs", "chipmunk_remove_resource_tabs");
```

## Change default required submission fields

`chipmunk_submission_required_fields`

```php functions.php theme={null}
function chipmunk_submission_required_fields()
{
  return ["name", "collection"];
}
add_filter("chipmunk_submission_required_fields", "chipmunk_submission_required_fields");
```

## Change default submission post status

`chipmunk_submission_post_status`

```php functions.php theme={null}
// Automatically publish resource submissions
function chipmunk_submission_post_status()
{
  return "publish";
}
add_filter("chipmunk_submission_post_status", "chipmunk_submission_post_status");
```

## Change max length of category names

`chipmunk_term_max_length`

```php functions.php theme={null}
// Change default maximum length of collection/category names in meta tags
function chipmunk_change_term_max_length()
{
  return 50; // Use 0 to display full term name
}
add_filter("chipmunk_term_max_length", "chipmunk_change_term_max_length");
```

## Shuffle term names in meta bar

`chipmunk_shuffle_terms`

```php functions.php theme={null}
function chipmunk_enable_shuffle_terms()
{
  return true;
}
add_filter("chipmunk_shuffle_terms", "chipmunk_enable_shuffle_terms");
```

## Change the newsletter email field name

`chipmunk_newsletter_email_field`

Useful if you have a custom form with a different field name.

```php functions.php theme={null}
function chipmunk_change_newsletter_email_field()
{
  return "email";
}
add_filter("chipmunk_newsletter_email_field", "chipmunk_change_newsletter_email_field");
```

## Add extra hidden input fields

`chipmunk_newsletter_args`

Some email providers require additional hidden fields to be sent with the form. You can add them using this filter.

```php functions.php theme={null}
function chipmunk_change_newsletter_args()
{
  return [
    "meta_required" => "email",
    "redirect" => "https://example.com",
  ];
}
add_filter("chipmunk_newsletter_args", "chipmunk_change_newsletter_args");
```
