How to create a custom template
This section is intended for developers. Basic knowledge of PHP and CSS is required to customize default templates or create your own templates.
Refer to the "ChatGTP Template Creator" documentation section for instructions on creating templates using ChatGPT.
Content Egg templates combine HTML layout with PHP code to display product data. Bootstrap 5 is embedded in the plugin by default, so you can use any Bootstrap CSS classes to ensure a responsive and modern design.
Steps to Create a Custom Template
Starting Code:
Your template must start with the following code:
Replace 'My template name' with the actual name of your template.
Add a Div Container:
Next, add the following div container:
Implement a Product Loop:
Implement a loop to iterate through and display all products:
Product Fields:
The
$item
array contains the following product fields:unique_id
title
description
img
url
price
priceOld
currency
currencyCode
percentageSaved
manufacturer
rating
domain
merchant
logo
ean
images
subtitle
promo
shipping_cost
last_update
Output Product Data:
To output product data, use the following snippets. Ensure to escape data output with the related WordPress functions.
Product Title:
Product Affiliate URL:
Product Image:
Product Description:
Product Price:
Product Old Price:
Merchant Domain:
Merchant Logo URL:
Merchant Small Icon URL:
Product Stock Status String:
Product Last Update Date Timestamp:
Amazon Price Update Notice:
Affiliate Disclaimer:
Badge:
Read next:
Last updated