PluginProbe
Posts Table with Search & Sort / 1.3.5
Posts Table with Search & Sort v1.3.5
trunk 1.0 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.1 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.2 1.3 1.3.1 1.3.1-v2 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.7 1.3.8 All 39 releases
posts-data-table / src / Table_Shortcode.php

Table_Shortcode.php in Posts Table with Search & Sort 1.3.5, at src/Table_Shortcode.php

41 lines 1.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace Barn2\Plugin\Posts_Table_Search_Sort;
3
4 use Barn2\PTS_Lib\Registerable,
5 Barn2\PTS_Lib\Service;
6
7 /**
8 * This class handles the posts table shortcode registration.
9 *
10 * @package Barn2\posts-table-search-sort
11 * @author Barn2 Plugins <support@barn2.co.uk>
12 * @license GPL-3.0
13 * @copyright Barn2 Media Ltd
14 */
15 class Table_Shortcode implements Registerable, Service {
16
17 const SHORTCODE = 'posts_table';
18
19 public function register() {
20 add_shortcode( self::SHORTCODE, array( $this, 'do_shortcode' ) );
21 add_shortcode( 'posts_data_table', array( $this, 'do_shortcode' ) ); // back compat: support old shortcode
22 }
23
24 /**
25 * Handles our posts data table shortcode.
26 *
27 * @param array $atts The shortcode attributes specified by the user.
28 * @param string $content The content between the open and close shortcode tags (not used)
29 * @return string The shortcode output
30 */
31 public function do_shortcode( $atts, $content = '' ) {
32 // Parse attributes
33 $atts = shortcode_atts( Simple_Posts_Table::get_defaults(), $atts, self::SHORTCODE );
34
35 // Create table and return output
36 $table = new Simple_Posts_Table();
37 return $table->get_table( $atts );
38 }
39
40 }
41