# ever-compare/1.0.0/includes/classes/Frontend/Shortcode.php

Ever Compare – Products Compare Plugin for WooCommerce, version 1.0.0. 59 lines.

- Page: https://pluginprobe.com/plugins/ever-compare/1.0.0/code/includes/classes/Frontend/Shortcode.php
- Raw: https://pluginprobe.com/plugins/ever-compare/1.0.0/raw/includes/classes/Frontend/Shortcode.php
- Modified: 2021-02-13T08:27:50+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/ever-compare/1.0.0/code/includes/classes/Frontend/Shortcode.php#L10-L20`.

```php
<?php
namespace EverCompare\Frontend;

/**
 * Shortcode handler class
 */
class Shortcode {

    /**
     * [$_instance]
     * @var null
     */
    private static $_instance = null;

    /**
     * [instance] Initializes a singleton instance
     * @return [Base]
     */
    public static function instance() {
        if ( is_null( self::$_instance ) ) {
            self::$_instance = new self();
        }
        return self::$_instance;
    }

    /**
     * Initializes the class
     */
    function __construct() {
        add_shortcode( 'evercompare_button', [ $this, 'button_shortcode' ] );
        add_shortcode( 'evercompare_table', [ $this, 'table_shortcode' ] );
    }

    /**
     * [button_shortcode] Compare Button Shortcode callable function
     * @param  [type] $atts 
     * @param  string $content
     * @return [HTML] 
     */
    public function button_shortcode( $atts, $content = '' ){
        wp_enqueue_style( 'evercompare-frontend' );
        wp_enqueue_script( 'evercompare-frontend' );
        return Manage_Compare::instance()->add_to_compare_btn();
    }

    /**
     * [table_shortcode] Compare table shortcode callable function
     * @param  [type] $atts
     * @param  string $content
     * @return [HTML] 
     */
    public function table_shortcode( $atts, $content = '' ){
        wp_enqueue_style( 'evercompare-frontend' );
        wp_enqueue_script( 'evercompare-frontend' );
        return Manage_Compare::instance()->compare_table_shortcode();
    }

}

```
