When you install the Affiliate Product Reviews plugin, you might have noticed the following message:
First of all, don’t you worry! Basically, you can click “Hide this notice” and you’re good, because you can integrate Affiliate Product Reviews in several ways. One way and in our view the most powerful ist by creating a child theme. But you will need to know some coding like PHP, HTML and CSS. But once, you know the basics, its super easy and you will be able to do fantastic stuff with this plugin.
For starters, have a look into our Step by Step guide, which explains to you, how to work with this plugin without any coding. Its georgeous too
What is a child theme?
If you don’t know at all how to create a child theme or what this even means, we recommend, you read this instructions first.
Start the Product Review Theme
If you know, what child themes are all about and you basically know, how you create a child theme, we will start now to create a child theme, which supports the Affiliate Product Review plugin.
If a theme does not support the plugin, the corresponding admin notice is the most visible result of the lacking support. But to hide this notice is not the first reason, why a plugin should declare its support. Out of this declaration, which comes with some design decisions, some of the internal plugin functions will work in a different way.
Along with the declaration of support, a theme needs to declare whether it supports the custom post type of the plugin or if it supports the usual blog posts to be reviews. If a theme does so, the template tab in the plugin settings will disappear, since the theme provides the plugin with a template.
If you want your blog posts to be reviews, you declare this by the following statement in your functions.php:
The first argument of the
add_theme_support() function is
'ri' and declares the support for the plugin, while the second argument
'post' specifies this declaration and tells the plugin, posts are used to display the reviews.
Now, your main file, which needs to be altered will be the single.php, which is responsible for displaying the posts e.g. reviews.
If you change the second argument to
'cpt', you will support the custom post type
'ri' for the reviews. This post type will be provided by the plugin. Your main template file, which is responsible for the rendering of the reviews, will now be single-ri.php.
The Twenty Fifteen Review theme
We provide you with a free demonstration theme: The Twenty Fifteen Product Review theme. Here, you will see a working example of a child theme, which supports the Affiliate Product Review plugin.
This theme supports blog posts as being reviews. Since Twenty Fifteen is using template parts, you will find an altered content.php instead of an altered single.php, but the principles remain the same.
The template tags
The last remaing question is, what template tags does the plugin provide for theme authors? Please have a look into our template tag list.