PluginProbe
Powerkit – Supercharge your WordPress Site / 2.9.0
Powerkit – Supercharge your WordPress Site v2.9.0
3.1.1 3.1.0 3.0.9 3.0.8 trunk 2.2.6 2.2.7 2.2.8 2.2.9 2.3.0 2.3.1 2.3.2 2.3.3 2.3.4 2.3.5 2.3.6 2.3.7 2.3.8 2.3.9 2.4.0 2.4.1 2.4.2 2.4.3 2.4.4 2.4.5 All 87 releases
powerkit / modules / twitter / public / class-powerkit-twitter-shortcode.php

class-powerkit-twitter-shortcode.php in Powerkit – Supercharge your WordPress Site 2.9.0, at modules/twitter/public/class-powerkit-twitter-shortcode.php

84 lines 2.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Shortcode Twitter
4 *
5 * @link https://codesupply.co
6 * @since 1.0.0
7 *
8 * @package PowerKit
9 * @subpackage PowerKit/shortcodes
10 */
11
12 /**
13 * Twitter Shortcode
14 *
15 * @param array $atts User defined attributes in shortcode tag.
16 * @param string $content Shorcode tag content.
17 * @return string Shortcode result HTML.
18 */
19 function powerkit_twitter_shortcode( $atts, $content = '' ) {
20 $params = powerkit_shortcode_atts( shortcode_atts( array(
21 'title' => esc_html__( 'Twitter Feed', 'powerkit' ),
22 'number' => 5,
23 'template' => 'default',
24 'header' => true,
25 'button' => true,
26 ), $atts ) );
27
28 ob_start();
29
30 powerkit_twitter_get_recent( $params );
31
32 return ob_get_clean();
33 }
34 add_shortcode( 'powerkit_twitter_feed', 'powerkit_twitter_shortcode' );
35
36 /**
37 * Map Twitter Shortcode into the Basic Shortcodes Plugin
38 */
39 if ( function_exists( 'powerkit_basic_shortcodes_register' ) ) :
40
41 $shortcode_map = array(
42 'name' => 'twitter',
43 'title' => esc_html__( 'Twitter Feed', 'powerkit' ),
44 'priority' => 100,
45 'base' => 'powerkit_twitter_feed',
46 'autoregister' => false,
47 'fields' => array(
48 array(
49 'type' => 'input',
50 'name' => 'number',
51 'label' => esc_html__( 'Number of tweets to displays', 'powerkit' ),
52 'default' => 5,
53 ),
54 array(
55 'type' => 'checkbox',
56 'name' => 'header',
57 'label' => esc_html__( 'Display header', 'powerkit' ),
58 'default' => true,
59 ),
60 array(
61 'type' => 'checkbox',
62 'name' => 'button',
63 'label' => esc_html__( 'Display follow button', 'powerkit' ),
64 'default' => true,
65 ),
66 ),
67 );
68
69 $templates = apply_filters( 'powerkit_twitter_templates', array() );
70
71 if ( count( (array) $templates ) > 1 ) {
72 $shortcode_map['fields'][] = array(
73 'type' => 'select',
74 'name' => 'template',
75 'label' => esc_html__( 'Template', 'powerkit' ),
76 'default' => 'default',
77 'options' => powerkit_twitter_get_templates_options(),
78 );
79 }
80
81 powerkit_basic_shortcodes_register( $shortcode_map );
82
83 endif;
84