Plugin Demo: Trend using Thumbs Rating
Trend demo is made to showcase the customization for Thumbs Rating method, and it covers several areas interesting for customization and the way you can use the plugin and this method.
Check out the demo page to see the information about the customization done. And, you can download the full demo to test on your development server, to make changes and learn more about the plugin customizations process.
trend.gdratingsystem.review
Installation Process
- Install the theme First from WordPress.org repository.
- Install the GD Rating System Pro.
- Install the demo plugin (gdrts_demo_trend_plugin.1.0.zip).
- Install the demo theme (gdrts_demo_trend_theme.1.0.zip).
- Activate the demo plugin and demo theme (First – Trend).
- Now, you can import the demo data from the XML file (gdrts_demo_trend_data.1.0.zip – XML is in the archive).
- And, finally, import the GD Rating System Pro settings (gdrts_demo_trend_settings.1.0.zip – settings file is in the archive).
Demo Contents
The Plugin
The plugin used for this demo, contains various customizations, including the font with icons for Thumbs, custom template for the thumbs rating, full override for the thumbs rendering and registration of the two extra thumbs rendering themes. Main entry file is core/demo.php. This file does a lot of things:
- registration of the new post type ‘product’ – action init.
- registration of the new templates path inside the plugin ‘templates’ directory – filter gdrts_default_templates_storage_paths.
- registration of the new thumbs themes – filter gdrts_list_thumbs_style_theme.
- registration of the icons font – action gdrts_register_icons_fonts.
- load the thumbs rating replacement rendering class – action gdrts_single_render_pre_process.
- enqueue additional JavaScript file – action gdrts_enqueue_core_files_after_evenets.
The font is defined using the core/font.php file. And, the replacement render class is defined in the core/render.php file. The class gdrts_trend_render_single_thumbs_rating extends default render class gdrts_render_single_thumbs_rating and replaces the methods that render the thumbs rating blocks so that we can change the order of the elements displayed, and to show the overall rating as the part of the rating block.
File js/trend.js hooks into the action that is fired as soon as the rating is saved gdrts-thumbs-rating-voted, and if the rating is for the ‘product’ post type, the script finds the parent article and applies the gdrts-demo-thumb-voted class for marking the rated article. File font/styles.php is the definition of the font we are adding, and also includes the styling for the Trend and Trend Comment styling.
The Theme
The main thing with the theme is adding of the content-product-archive.php and content-product-single.php templates to render single product in the archives (archive-product.php) and single view (single-product.php). Rating rendering is integrated into these files. And, the comments.php file is modified to implement sorting of the comments by Thumbs Rating value.
Plugin Settings
Once you import GD Rating System Pro settings, it will configure Thumbs Rating, and will also set Products archive to auto order products by Thumbs Rating value.
trend.gdratingsystem.review