# Frontend Search

With Content Egg, you can add each deal as a separate post. WordPress searches by post titles, but if you want a search form that shows results from affiliate networks directly (without creating posts for each deal), you can use Content Egg's Frontend Search function.

<figure><img src="https://4254262503-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M3fnB7iKYwDc1Xhr3H3%2Fuploads%2FROs0bWAcQxna7oKwAHEv%2Fimage.png?alt=media&#x26;token=b2956615-57c5-4445-9f9c-df6769e7f96d" alt=""><figcaption></figcaption></figure>

<figure><img src="https://4254262503-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M3fnB7iKYwDc1Xhr3H3%2Fuploads%2FwY0N6qmgK31aQfrwCaKr%2Fimage.png?alt=media&#x26;token=1aa1c35d-545c-4a08-820c-93a37409002e" alt=""><figcaption></figcaption></figure>

You need to create two things: a page with the search form (or widget) and a page for displaying the results.

### Creating a Search Form

There are several ways to show the affiliate search form with Content Egg:

1. **Using a Widget**:
   * Find the widget **CE: Product Search** in **Appearance – Widgets**.
   * Place the widget in a sidebar. It will have the same styling as a standard WordPress widget.
2. **Using a Shortcode**:
   * Use the shortcode `[content-egg-search-form]`.
   * This shortcode will generate a standard WordPress search form and direct users to a special page with results from affiliate modules instead of the default WordPress search page.
   * The shortcode design matches the standard WordPress search form.

Please note, some themes can extend the Content Egg search form. For example, Rehub offers additional shortcodes.

#### Search Settings

The next step is to set up the page for output results. To do this:

1. Go to **Content Egg – Settings – General**.
2. Add the output shortcode to the text area labeled **Search page template**.

I recommend using common shortcodes of Content Egg. For example:

```
[content-egg-block template=offers_list]
```

![](https://4254262503-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M3fnB7iKYwDc1Xhr3H3%2F-M5282y3JZHa7ovrDMsC%2F-M529PZwlI3QJk8ae50S%2FNewItem97.png?alt=media\&token=f4deeb14-01b8-49dd-a71e-b1424640bcf7)

### Customization

To configure the search form, create a `ce-product-searchform.php` file in the root directory of your theme (or child theme). Add and customize the form code:

```php
<form role="search" method="get" class="search-form" action="<?php echo esc_attr(\ContentEgg\application\ProductSearchWidget::getSearchFormUri()); ?>">
      <input type="text" name="s" placeholder="Product search...">
      <button type="submit">Search</button>
</form>
```

To configure the global page template with a search result, create a `ce-product-search.php` file in the root directory of your theme (or child theme). Use code similar to the code in your `page.php` template.

To configure `product-search` in the URL search form, use a filter that returns a new slug:

```php
add_filter('cegg_product_search_slug', 'example_callback');
```
