Advanced Widget

advanced mode
The Advanced Widget of the CompariPress Companion plugin gives you unlimited control of how and where to display your CompariPress products. The CompariPress Companion Advanced Widget can look any way you want, contain anything you want, display any products, in any order (well, you get the picture…).

Widget Structure

The Advanced Widget is structured by 3 main components:

1. Surrounding HTML (HTML Before & HTML After fields) – Here you can place optional HTML or even PHP code that will sorround your unit, in case you want to customize your widget beyond your theme’s default widget style. For instance, if you don’t like your widget’s title you can leave it blank and use the HTML Before field to create your own title. You can also use any Widget Scope shortcodes in these sections.

2. Internal Units Surrounding HTML (HTML Before Unit & HTML After Unit fields) – If you are using multiple custom fields per widget (see below), this is where you would place your code (PHP, HTML or Unit Scope shortcodes) that surrounds and separates each internal unit.

3. Loop – This is the core of the widget and is where the actual products will show up. Any code you place here will be duplicated for each product that is displayed in the widget. You may place PHP, HTML and Product Scope shortcodes here.


In order to display your products, CompariPress Companion offers you an entire array of shortcodes for interfacing with CompariPress. Shortcodes allow you to pull all of the information stored by CompariPress such as the product’s price, image, merchant name, logo and much more.
Shortcodes are not only intended for use within the Loop. For instance, the shortcode [cpc_max_price] can work in a number of places and will return the correct result in each. If you place the shortcode in the section sorrounding a unit, the output will be the price of the most expensive item in that unit. If however, you place the shortcode in the section sorrounding a widget that contains multiple units, the shortcode will return the price of the most expensive item from all of the units.

Shortcodes can even be used in the body of your posts. To learn about shortcode behaviour in the body of your post, please see the shortcode section.

Multiple PCU’s

With the Advanced Widget, the fixed relationship between PCU and posts is completely lifted. In fact, you no longer have to look at your PCU’s as display modules but rather as groups of products. The difference? Not only can you place multiple price comparison modules in a single widget, you can actually create a single price comparison module that combines products from multiple PCU’s. Assigning PCU’s to posts is easy. Simply place the PCU id into a custom field of your choice and enter the name of the custom field in the appropriate field of the Advanced Widget settings.

There are 3 options for placing multiple PCU’s on a single page:

1. Separate widgets – Simply create a separate widget for each of the modules you want to display on your page and enter a different custom field name for each. With this option you can style each widget differently.

2. Multiple Custom Fields per Widget – You may place more than one custom field name in an individual widget, simply separate each custom field with a comma. When utilizing this option, you will have one widget (with one title, border and other defining widget styles) which will contain separate price comparison modules withing the widget. Use the “HTML Before Unit” and “HTML After Unit” settings to style the way each internal module will be displayed and separated from its peers.

3. Items from Multiple PCU’s Merged into One Module – If you would like to have products from more than one PCU show up in a sinlge Price Comparison Module (mixed together), you can enter more than one PCU ID number in your custom field. Simply separate the various ID’s with commas.

The best part is – you can mix and match the above solutions to fit your needs (for instance, have more than one widget per post, each containing more than one custom field, each containing more than one PCU ID’s)

OfficeFolders theme by Themocracy