GuidePlugin LogoGuidePlugin Docs

guideplugin/result/template/module

Customize the HTML code of each template module

guideplugin/result/template/module

Definition

With this filter you can customize the HTML code of each template module.

This is an advanced hook that allows you to modify individual modules within the result template, such as title, content, or custom modules.

Parameters

apply_filters('guideplugin/result/template/module', $html, $module, $post_id, $guide_id);
ParameterTypeDescription
$htmlstringThe HTML code of the module
$modulearrayThe data of the module
$post_idintThe post ID
$guide_idintThe guide ID

Example

The example shows you how to assign an external link of a WooCommerce product to the title module (advanced):

function my_guide_template_module_title($html, $module, $post_id, $guide_id)
{
    // Only modify title module on guide with ID 24
    if ($module['module'] == 'title' && $guide_id == 24 && function_exists('wc_get_product')) {

        $product = wc_get_product(get_the_ID());

        if ($product->is_type('external')) {
            ob_start();
            ?>
                <a href="<?php echo $product->get_product_url();?>" class="guide-result-template-title"><?php echo get_the_title(); ?></a>
            <?php
            return ob_get_clean();
        }

    }

    return $html;

}
add_filter('guideplugin/result/template/module', 'my_guide_template_module_title', 10, 4);

Usage Scenarios

Module-Specific Logic

Apply different behavior to specific template modules

Advanced Integration

Integrate with WooCommerce, ACF, or other plugins

Dynamic Content

Modify module output based on post type or conditions