Working with own rendering templates

Previous tutorial was about the basics of the gdT3 templates rendering engine powering the GD Products Center Pro plugin, and now here are some practical advices on how to start with your own rendering templates: to replace default ones or to add additional templates.

There are two ways to handle your own templates: through theme and standalone folder. Make sure that you read the gdT3 basics tutorial and note that rendering templates used by gdT3 and plugin are not the same as WordPress theme templates. If you plan to make changes to some (or all) default templates, you need to copy them into location of your choosing (read on for more info). Never edit templates in the plugin folder, all changes will be lost when plugin is updated.

Theme Specific Rendering Templates

If you want to make changes to the rendering templates to fit your theme, best thing is to add them to the theme. If you decide on adding them to the theme, it is also recommended to use functions.php file in the theme to add templates location to the plugin. So, if you create a folder in your theme folder called gdpc-tpl, this is the folder where you will store all the rendering templates for the plugin. You can use code similar to the code in previous tutorial. This time, add this to the functions.php:

[php]add_filter(‘gdpc_init_templates_storage’, ‘gdpc_my_templates’);
function gdpc_my_templates($list) {
$list[] = STYLESHEETPATH.’/gdpc-tpl/’;
return $list;

If you decide to use this method in the multisite environment, all sites in the network using GD Products Center using the theme you modified, will be able to see the templates in that theme. If you don’t want that you can use standalone locations for extra templates.

Standalone Rendering Templates

If you simply need your own templates, and you don’t need to mess with the theme, you can create your own folder where you can store the templates. If you run normal (not a multisite) WordPress website, create a folder called gdpc into wp-content folder. This way it will be easy to find and work with. To let plugin know about it, open plugin Settings panel, and on the first Basic tab find Render Templates Location block. In the locations list add simply this: gdpc. And save.

For multisites, you can use same method and let your users know how to add this extra location to their plugin settings. In the future versions of the plugin, there will be editor for rendering templates that will have simpler ways for adding new templates to custom locations for multisite and normal website.

Theme specific styling for plugin rendering

Plugin has built in stylesheet for the rendering templates, and by default it loads this file. If you want to completely replace it, you can disable loading of this stylesheet from plugin Settings panel, Integration tab, Load block. But, you can also override this file styles by adding your own styles through your theme. Some of the xScape Themes Framework based these on Dev4Press add own color styling and other styling to change default plugin rendering and make it more theme specific.

Each page rendered by the template related to GD Products Center will have gdpc-page class added to the page BODY tag. You can use this for some styling changes. If you use shortcodes to embed data on some unrelated page, this class will not be present in the BODY tag.


Leave a Reply