Product Reviews Integration With Thesis Theme 2.1
- August 19, 2015
- Leave a comment
Nowadays, most of people rely on product reviews for online purchase decisions and they want to make sure that they know what people feel about a specific product. It adds great utility to the business owners too as it serves as a tool to enhance the trust of their most loyal customers and also wins the trust of new ones when they see good reviews about any business.
We have got a requirement to integrate product reviews with Thesis Theme version 2.1, through which admin/author could add review for the number of products divided in different categories through back-end and visitor/user can read the review while browsing the website. For this, we have followed the plugin approach to incorporate the reviews within Client’s website.
Creating Plugin “Product Reviews Post Type”:
We have created the plugin using class based approach, defining all the base methods to include the activation/deactivation functions and script and style enqueuing functions.
We created custom post type “Reviews” with the support of review categories. Meta boxes were also added to the custom post type where admin can add review heading, product rating, favorites, YouTube video link and custom meta information related to the product.
We have also added the capability to add featured image to category same as we added to post, which is viewable at front-end while displaying the categories for products reviews.
Front End Templates for Thesis 2.1:
We had to create three templates at front-end where our reviews will be shown to end user. Below mentioned are the templates that we created to view the products reviews at front end:
1. Template For Review Archive & Reviews:
Thesis 2.1 has its own template engine which is managed through Thesis Skin Editor. We followed the below mentioned steps to create the template for Review Archive:
We created a hook using the method hook_bottom Thesis provides:
Here hook-name and function-name was replaced by the original names of the hook and function we used. We added the code that shows the products and their reviews residing in that category. After this, we added a new HTML Container Box to the Review Archive skin in the Thesis Skin Editor. For this, we added the hook-name to the HTML Container Box under the Hook Name text-box, and there we go. Now products reviews are enabled on the Category Archive page.
2. Template To View All Product Review Categories:
To view all categories, we have created a short-code [review_categories] within the plugin. We added this short-code to the page to view all the categories for Products Reviews.
3. Template To View Product Review Categories On Homepage:
We have added a block to already created homepage template hooks which was created through Thesis Skin Editor to view the categories on homepage as well.