# For developers

### Custom templates

You can add to your theme unique templates for the Content Egg plugin.

{% content-ref url="/pages/nSafB3KwpkoYKiQnamjl" %}
[Custom Templates](/custom-templates/customizing-templates-with-css.md)
{% endcontent-ref %}

### Front search customization

{% content-ref url="/pages/-M4jeTxp2nFL5Neqyd-k" %}
[Frontend Search](/frontend/frontendsearch.md)
{% endcontent-ref %}

### REST API

{% content-ref url="/pages/N7pkUlqzmMuNxPnLZzvK" %}
[REST API](/customization/rest-api.md)
{% endcontent-ref %}

### Accessing and Modifying Data with Hooks

The Content Egg plugin provides several WordPress hooks to allow developers to interact with the data lifecycle. Below is a detailed reference for working with Content Egg data and customizing its behavior.

#### `content_egg_save_data`

```php
add_action('content_egg_save_data', 'my_function', 13, 4);
```

**Description**:\
Triggered after saving or updating Content Egg data for a post. Useful for intercepting or modifying saved data per module.

**Parameters**:

* `$data` *(array)* — Raw data array saved by the module.
* `$module_id` *(string)* — ID of the Content Egg module (e.g., `amazon`, `ebay`).
* `$post_id` *(int)* — WordPress Post ID.
* `$is_last_iteration` *(bool)* — Whether this is the final module being processed for this post.

#### `cegg_autoblog_post_create`

```php
add_action('cegg_autoblog_post_create', 'my_function', 10, 1);
```

**Description**:\
Triggered right after a new post is created by the Auto Blog functionality.

**Parameters**:

* `$post_id` *(int)* — ID of the newly created post.

### Accessing Stored Module Data

#### Raw Module Data (Unprocessed)

Content Egg stores module data in standard WordPress custom fields. To retrieve raw data:

```php
get_post_meta($post_id, '_cegg_data_' . $module_id, true);
```

* Returns an **array** of module results for the given post and module.
* Useful for debugging or low-level manipulation.

#### Processed View Data (Recommended for Display)

To get data already processed and formatted for display (e.g., as shown in templates):

```php
\ContentEgg\application\components\ContentManager::getViewData($module_id, $post_id);
```

* Returns **render-ready** data.
* Ideal for use in custom themes or shortcodes.

### Filters for Customization

#### Filter: Module Templates

```php
add_filter('content_egg_module_templates', 'my_filter_function', 10, 2);
```

* **$templates** *(array)* — List of available templates.
* **$module\_title** *(string)* — Human-readable title of the module (e.g., "Amazon", "eBay").

Use this to modify or restrict which templates are available for a module.

#### Filter: Block Templates

```php
add_filter('content_egg_block_templates', 'my_filter_function');
```

Customize the available **block templates** across modules.

#### Filter: Enable/Disable Modules

```php
add_filter('content_egg_modules', 'my_filter_function');
```

Dynamically enable or disable Content Egg modules.

> ⚠️ **Important**: Use with caution. If you're disabling default features in your theme or plugin, **always inform users** clearly about the changes and rationale.


---

# 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://ce-docs.keywordrush.com/customization/fordevelopers.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.
