# fluent-cart/1.6.5/app/Hooks/Handlers/TemplateLoader.php

FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler, version 1.6.5. 62 lines.

- Page: https://pluginprobe.com/plugins/fluent-cart/1.6.5/code/app/Hooks/Handlers/TemplateLoader.php
- Raw: https://pluginprobe.com/plugins/fluent-cart/1.6.5/raw/app/Hooks/Handlers/TemplateLoader.php
- Modified: 2025-10-14T16:36:46+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/fluent-cart/1.6.5/code/app/Hooks/Handlers/TemplateLoader.php#L10-L20`.

```php
<?php

namespace FluentCart\App\Hooks\Handlers;

use FluentCart\App\CPT\FluentProducts;
use FluentCart\App\Models\ProductDetail;

class TemplateLoader
{
    public function init()
    {
        add_action('fluent_cart/single_product_summary', [$this, 'showTitle'], 10);
        add_action('fluent_cart/single_product_summary', [$this, 'showExcerpt'], 20);
        add_action('fluent_cart/single_product_summary', [$this, 'showBuy'], 25);
    }

    public function showTitle()
    {
        global $post;
        echo wp_kses_post('<h1>' . $post->post_title . '</h1>');
    }

    public function showExcerpt()
    {
        global $post;
        $short_description = apply_filters('fluent_cart/product_short_description', $post->post_excerpt, []);
        ?>
        <div class="fct_product-details_short_description">
            <?php echo wp_kses_post($short_description); // WPCS: XSS ok.
            ?>
        </div>
        <?php
    }

    public function showBuy()
    {
        global $product_detail;

        ?>
        <p class="<?php echo esc_attr(apply_filters('fluent_cart/price_class', 'price')); ?>"><?php echo wp_kses_post($product_detail->getPriceHtml()); ?></p>
        <button type="submit" name="add-to-cart" value="<?php echo esc_attr($product_detail->id); ?>"
                class="single_add_to_cart_button button alt">Buy Now
        </button>
        <?php
    }

    // public function loadTemplate($template)
    // {
    //     if (is_singular(FluentProducts::CPT_NAME)) {
    //         global $post;
    //         unset($GLOBALS['product_detail']);
    //         $product = ProductDetail::where('product_id', $post->ID)->first();

    //         $GLOBALS['product_detail'] = $product;

    //         return FLUENTCART_PLUGIN_PATH . 'templates/single-product.php';
    //     }

    //     return $template;
    // }
}

```
