# wp-ultimate-post-grid/3.3.0/includes/public/class-wpupg-template-shortcode.php

WP Ultimate Post Grid, version 3.3.0. 46 lines.

- Page: https://pluginprobe.com/plugins/wp-ultimate-post-grid/3.3.0/code/includes/public/class-wpupg-template-shortcode.php
- Raw: https://pluginprobe.com/plugins/wp-ultimate-post-grid/3.3.0/raw/includes/public/class-wpupg-template-shortcode.php
- Modified: 2020-01-24T07:47:12+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/wp-ultimate-post-grid/3.3.0/code/includes/public/class-wpupg-template-shortcode.php#L10-L20`.

```php
<?php
/**
 * Parent class for the template shortcodes.
 *
 * @link       https://bootstrapped.ventures
 * @since      3.0.0
 *
 * @package    WP_Ultimate_Post_Grid
 * @subpackage WP_Ultimate_Post_Grid/includes/public
 */

/**
 * Parent class for the template shortcodes.
 *
 * @since      3.0.0
 * @package    WP_Ultimate_Post_Grid
 * @subpackage WP_Ultimate_Post_Grid/includes/public
 * @author     Brecht Vandersmissen <brecht@bootstrapped.ventures>
 */
class WPUPG_Template_Shortcode {
	public static $attributes = array();
	public static $shortcode = '';

	public static function init() {
		$shortcode = static::$shortcode;

		if ( $shortcode ) {
			// Register shortcode in WordPress.
			add_shortcode( $shortcode, array( get_called_class(), 'shortcode' ) );

			// Add to list of all shortcodes.
			WPUPG_Template_Shortcodes::$shortcodes[ $shortcode ] = static::$attributes;
		}
	}

	public static function get_hook() {		
		return str_replace( '-', '_', static::$shortcode ) . '_shortcode';
	}

	protected static function get_attributes( $atts ) {
		$atts = shortcode_atts( WPUPG_Template_Shortcodes::get_defaults( static::$shortcode ), $atts, str_replace( '-', '_', static::$shortcode ) );

		return $atts;
	}
}

```
