👉Shortcode parameters

Shortcode parameters allow you to control both the product data output and the layout design in Content Egg. These parameters can be applied similarly for both module-specific and global shortcodes.

1. Data Filtering and Selection

limit

The limit parameter controls how many items are displayed in the output. It restricts the product count to a specified number.

Display the first 5 products only:

[content-egg-block template=offers_logo limit=5]

offset

The offset parameter skips a specified number of items before starting the output, allowing you to control where the product listing begins.

Combining limit with offset: If you want to show a specific subset of products (e.g., products 6 to 10), you can combine limit with offset:

[content-egg-block template=offers_logo limit=5 offset=5]

next

The next parameter is used to divide a product list into separate blocks, allowing you to display items in sequential batches. Each time you use the shortcode with the next parameter, it shows the next set of products.

Display the first two products:

[content-egg module=Amazon next=2]

Display the next four products after the first two:

[content-egg module=Amazon next=4]

Each time you increase the next value or repeat the shortcode, the next set of items will be shown.

post_id

The post_id parameter lets you display Content Egg data from one post in any other post, page, or widget. This is useful for reusing product data across your site without duplication.

[content-egg-block template=offers_logo post_id=123]

modules

The modules parameter allows you to specify which modules to pull data from by using module IDs, not the module names. You can find the correct module IDs in the Content Egg settings pages under the specific module configurations.

You can add as many module IDs as needed, separated by commas.

[content-egg-block template=offers_logo modules="Amazon,Ebay2"]

exclude_modules

Excludes certain modules from the output.

Example: To exclude Amazon from a price history graph, you can use the following shortcode:

[content-egg-block template=price_history exclude_modules=Amazon]

sort

The sort parameter sets the sorting criteria for products, with options: price, discount, reverse, and total_price.

Example:

[content-egg module=Amazon template=list sort=discount]

This sorts products by the highest discount first.

For more detailed information on product sorting options, click here.

order

The order parameter controls the sorting direction in sortable shortcodes, such as product lists. You can set it to either asc (ascending) or desc (descending).

Example:

[content-egg module=Amazon template=list sort=price order=desc]

By default, the sorting order is asc (ascending).

products

Filter products output by product ID. Click on the "id" button to add the product ID filter to the output shortcode. You can also set multiple IDs separated by commas.

groups

The groups parameter filters data based on predefined product groups. This allows you to display only products that belong to specific groups, providing a way to categorize and organize product outputs.

Example: To display products from a specific group, use:

[content-egg-block template=offers_logo groups="group_name"]

You can also display products from multiple groups by separating group names with commas.

For more details on how to set up and use groups, check the instructions here.

locale

The locale parameter can be used only with the Amazon, eBay, and Shopee modules to filter products based on the selected country.

Example: To display US-based products from Amazon, use:

[content-egg module=Amazon locale=US]

For details on integrating this with visitor geolocation plugins, please refer to the relevant documentation.

ean

The ean parameter filters products by one or more EAN codes. It allows you to narrow down the output based on specific product EANs.

Example: To display products with specific EAN codes, use:

[content-egg module=Amazon template=list ean=0711719765790,5016488137300]

Please note, this parameter does not add new products; it only filters the existing products in the output.

remove_duplicates_by

The remove_duplicates_by parameter removes duplicate products from the output by checking one of the specified product fields: orig_url, url, title, ean, or domain. The module priority will determine which duplicate product to keep. This parameter can only be used with block shortcodes.

Example:

[content-egg-block template=offers_list remove_duplicates_by=orig_url]

2. Data Changing:

currency

The currency parameter allows you to convert all offers in your product list to a single currency, ensuring consistency when products come from different regions with varying currencies.

Example: To convert all offers to EUR:

[content-egg-block template=offers_grid currency=EUR]

If the desired currency is not listed, you can manually add an exchange rate by modifying the functions.php file of your theme (or child theme) using a custom function like this:

Example (Adding a Custom Exchange Rate):

function my_content_egg_currency_rate ($rate, $from, $to)
{
    if ($from == 'USD' && $to == 'KES')
        return 100.15; // <--- exchange rate from USD to KES
    if ($from == 'KES' && $to == 'USD')
        return 0.01; // <--- exchange rate from KES to USD
}
add_filter( 'content_egg_currency_rate', 'my_content_egg_currency_rate', 0, 3 );

This allows you to manually set the conversion rate for any currency not natively supported by the plugin.

add_query_arg

The add_query_arg parameter allows you to modify affiliate URLs by appending custom query variables to the URL. This can be useful for adding tracking parameters or custom tags to the affiliate links.

Example: To add a custom tag to Amazon affiliate URLs, use:

[content-egg module=Amazon add_query_arg="tag=CUSTOM_TAG"]

This appends the tag=CUSTOM_TAG query variable to all Amazon product URLs, making it easy to customize the URL for tracking or other purposes.

keyword

The keyword parameter allows you to create an auto-updated list of products by specifying a keyword. It works only with module shortcodes and automatically filters products based on the provided keyword.

Example: To display a list of Amazon products related to "Echo Dot":

[content-egg module=Amazon template=list keyword="echo dot"]

You can also assign a custom group name by encoding the group separator ->:

[content-egg module=Amazon template=list keyword="echo dot-&gt;Smart speakers"]

Additionally, you can control the maximum number of results using the limit parameter:

[content-egg module=Amazon keyword="echo dot" limit=3]

The auto-update schedule and the maximum number of search results can be configured in each module's settings.

3. Template Output Customization

template

Defines the layout template used for displaying product data. Typically, you will set this parameter through the shortcode builder.

hide/visible

The hide and visible parameters allow you to control the display of specific elements in your product templates. Each template has default settings for what data is shown or hidden, but these parameters give you the flexibility to hide or force display certain fields.

hide: Hides specified fields that would otherwise be shown.

visible: Forces the display of fields that might be hidden by default.

Available Fields to Hide or Display:

badge, button, code, coupons,coupon_revival, delivery_at_checkout, description, disclaimer, domain, endDate, img, logo, merchant, new_used_price, number, percentageSaved, price, priceOld, price_update, prime, promo, rating, shipping_cost, shop_info, startDate, stock_status, subtitle, title

Example to Hide Multiple Fields:

[content-egg-block template=offers_list hide=price,shop_info]

Example to Display Hidden Fields:

[content-egg-block template=offers_list visible=description,badge]

These parameters give you control over which product data elements are shown or hidden, allowing you to customize the look and feel of your product display.

btn_variant

Changes the button style, allowing you to choose from a variety of predefined styles such as solid or outlined versions of different color schemes. The available options are:

primary, secondary, success, danger, warning, info, light, dark, link, outline-primary, outline-secondary, outline-success, outline-danger, outline-warning, outline-info, outline-light, outline-dark.

Note: btn_color is an alias for btn_variant.

You can also customize all the color themes for these styles (primary, secondary, etc.) in the Frontend settings of Content Egg.

Example: To set a button with the outline-primary style, use:

[content-egg-block template=offers_list btn_variant=outline-primary]

btn_text

Customizes the text displayed on buttons.

Example: To change the button text to "Check Price", use:

[content-egg-block template=offers_list btn_text="Check Price"]

This will override the default button text and display "Check Price" on all buttons.

color_mode

Changes the color theme for the current block. The only available option is color_mode=dark, which applies a dark theme to the block.

You can also set the Dark theme globally by going to Content Egg settings > Frontend > Color Mode.

Example:

[content-egg-block template=offers_list color_mode=dark]

cols

Controls the number of columns in grid templates. You can also adjust the number of columns across different screen sizes using the parameters cols_xs, cols_sm, cols_md, cols_lg, cols_xl, and cols_xxl.

cols is equivalent to cols_md (medium screens).

Example:

To set a grid with 4 columns for medium screens and 2 columns for small screens:

[content-egg-block template=offers_grid cols_md=4 cols_sm=2]

This will display 4 columns on medium screens and 2 columns on smaller screens, allowing for a responsive layout.

img_ratio

Specifies the aspect ratio of the product images in the display. Allowed values are 1x1, 4x3, 16x9, and 21x9.

Example: To set the image aspect ratio to 16x9, use:

[content-egg-block template=offers_grid img_ratio=16x9]

title_tag

Sets the HTML tag for the product title. Allowed values are div, h1, h2, h3, h4, h5, and h6.

Example: To set the product title as an h3 tag, use:

[content-egg-block template=offers_list title_tag=h3]

border

Adds a border to the product display. You can set the border width from 0 (no border) to 5 (thickest border) using this parameter.

Example: To add a border with a width of 3, use:

[content-egg-block template=offers_list border=3]

border_color

Specifies the color of the border. The allowed values are primary, secondary, success, danger, warning, info, light, and dark.

Example: To add a border with the danger color, use:

[content-egg-block template=offers_list border=2 border_color=danger]

tabs_type

Customizes the style of tabs for displaying products in templates that support tabs. The available options are:

  • tabs: Standard tab style.

  • pills: Rounded "pill" style tabs.

  • underline: Tabs with an underline for the active tab.

Example: To display tabs in "pills" style, use:

[content-egg-block template=offers_list_groups tabs_type=pills]

cols_order

Changes the display order of columns in templates with multiple columns. You can specify the order of columns by listing their numbers in the desired sequence.

Example: To rearrange the columns in the order 3, 2, 1, 5, 4, use:

[content-egg-block template=offers_logo cols_order=3,2,1,5,4]

This will display the third column first, followed by the second, and so on.

start_number

Specifies the starting number for product number badges. This is useful for listings where you want to start numbering from a specific value rather than 1.

Example: To start numbering products from 3, use:

[content-egg-block template=top_listing visible=number start_number=3]

This will make the list begin with number 3 for the first product.

title

Customizes or overrides the main title used in some templates.

Example:

[content-egg-block template=price_comparison_card title="Sony Playstation 5 Slim"]

show

The show parameter is used only with "customizable" block templates. It allows you to display specific information about a product, such as the price, title, button, etc. It's recommended to use this parameter in combination with the products parameter to target specific product information.

Available Fields for show:

button, currencyCode, img, img+url, last_update, price, priceOld, stock_status, title, url

Example:

To display only the price of a specific product (ID: 808726894), use:

[content-egg-block template=customizable product="808726894" show=price]

Low Price: Display the lowest price product:

[content-egg-block template=customizable show=price limit=1 sort=price order=asc]

High Price: Display the highest price product:

[content-egg-block template=customizable show=price limit=1 sort=price order=desc]

Customizing Templates with CSS:

Customizing templates with CSS

Last updated