Adjusting the Appearance of Recommendations

Recomendo uses WordPress template part files (partials) developed according to WordPress standards to display its recommendations and integrate seamlessly into your WordPress site. Template partials should be coded so that they can be used inside a standard WordPress loop.

If you are not using WooCommerce you can skip the next section and go directly to WordPress sites (without WooCommerce)

WooCommerce

 

Adjusting the appearance of the Recomendo Widget

recomendo widget settings

If your site is using WooCommerce and you have configured Product as the post type to recommend in the Recomendo dashboard page of your WordPress site, then the Recomendo widget will by default use the template part file content-product-widget.php of your child or parent theme to display its recommendations on sidebars or widget areas of your theme.

Alternatively, you can create your own template part file (which should be saved in your child theme) to control how you want to display recommendations in your site.

To use your newly crafted template part, simply go to Appearance > Widgets in your site’s WordPress dashboard, and change the file name in Template part setting of the Recomendo widget.

The default CSS class in WooCommerce for displaying products in sidebars is called product_list_widget, and is also the default value for the CSS class setting in the Recomendo Widget if using WooCommerce.

When using WooCommerce it’s possible to change the looks of the Recomendo widget by using your own custom CSS class. This setting does not have an effect if you are not using WooCommerce.

Adjusting the appearance of the Recomendo Shortcode

To adjust the appearance of the Recomendo shortcode, use the shortcode parameter template with the template part file of your child or parent theme that takes care of displaying the post type you configured in the Recomendo dashboard page.

If you are using WooCommerce, the default template part file name is content-product.php

Alternatively, you may choose to use your own custom template part easily by just changing the shortcode parameter template.

Example:

[recomendo template="featured-products"]
  •  This would use the template part file featured-products.php of your child or parent theme

 

WordPress sites (without WooCommerce)

 

Adjusting the appearance of the Recomendo Widget and Shortcode

In WordPress sites without WooCommerce, the Recomendo Widget and Shorcode will default to using the template part named content-postType.php where “postType” is the post type you configured as content to recommend in Recomendo settings.

In some themes, the file content-postType.php might not present in your child or parent theme, or might be called differently altogether. But most likely, your theme might already have a template part with the correct styling and format.

Let’s see next how we can find out which template part from our theme to use.

Exploring the content of your theme to select a template part for recommendations

We will use as an example the Twenty Fourteen theme from WordPress.

Go to your site’s admin dashboard and click on Appearance -> Editor

This will open the code editor. Please do not make any modifications to the files as it might bring down your site. 

By default, the editor will select the theme currently active. If you are using a Child theme, you might have to select the parent theme, as not all the theme files might be present in the child theme.

selecting a template part

Inspect the different theme files. If the theme followed WordPress naming conventions, it should be called content-{something}.php.

In our example the Twenty Fourteen theme has a template part file called content-featured-post.php.  This template part displays featured posts on the front page.

 

recomendo with the twenty fourteen theme

Here you can see the Recomendo Widget on the front page getting the correct styling and formatting by using the template part content-featured-posts.php

You can browse this template part in github.