# posts-data-table/1.1.3/includes/class-posts-data-table-shortcode.php

Posts Table with Search &amp; Sort, version 1.1.3. 40 lines.

- Page: https://pluginprobe.com/plugins/posts-data-table/1.1.3/code/includes/class-posts-data-table-shortcode.php
- Raw: https://pluginprobe.com/plugins/posts-data-table/1.1.3/raw/includes/class-posts-data-table-shortcode.php
- Modified: 2018-05-21T16:13:02+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/posts-data-table/1.1.3/code/includes/class-posts-data-table-shortcode.php#L10-L20`.

```php
<?php
// Prevent direct file access
if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

/**
 * This class handles the posts table shortcode registration.
 *
 * @package   Posts_Table_Search_And_Sort
 * @author    Barn2 Media <info@barn2.co.uk>
 * @license   GPL-3.0
 * @link      https://barn2.co.uk
 * @copyright 2016-2018 Barn2 Media Ltd
 */
class Posts_Data_Table_Shortcode {

	const SHORTCODE = 'posts_data_table';

	public static function register_shortcode() {
		add_shortcode( self::SHORTCODE, array( __CLASS__, 'do_shortcode' ) );
	}

	/**
	 * Handles our posts data table shortcode.
	 *
	 * @param array $atts The shortcode attributes specified by the user.
	 * @param string $content The content between the open and close shortcode tags (not used)
	 * @return string The shortcode output
	 */
	public static function do_shortcode( $atts, $content = '' ) {
		// Parse attributes
		$atts = shortcode_atts( Posts_Data_Table_Simple::$default_args, $atts, self::SHORTCODE );

		// Create table and return output
		$table = new Posts_Data_Table_Simple();
		return $table->get_table( $atts );
	}

}
```
