PluginProbe
Kit (formerly ConvertKit) – Email Newsletter, Email Marketing, Membership, Subscribers and Landing Pages / trunk
Kit (formerly ConvertKit) – Email Newsletter, Email Marketing, Membership, Subscribers and Landing Pages vtrunk
3.4.1 3.4.0 3.3.9 3.3.8 3.3.7 3.3.6 3.3.5 3.3.4 3.3.3 3.3.2 3.3.1 2.2.0 2.2.1 2.2.2 2.2.3 2.2.4 2.2.5 2.2.6 2.2.7 2.2.8 2.2.9 2.3.0 2.3.1 2.3.2 2.3.3 All 194 releases
convertkit / includes / class-convertkit-shortcodes.php

class-convertkit-shortcodes.php in Kit (formerly ConvertKit) – Email Newsletter, Email Marketing, Membership, Subscribers and Landing Pages trunk, at includes/class-convertkit-shortcodes.php

69 lines 1.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * ConvertKit Shortcodes class.
4 *
5 * @package ConvertKit
6 * @author ConvertKit
7 */
8
9 /**
10 * Registers shortcodes defined in the `convertkit_shortcodes` filter as WordPress Shortcodes.
11 *
12 * @package ConvertKit
13 * @author ConvertKit
14 */
15 class ConvertKit_Shortcodes {
16
17 /**
18 * Constructor
19 *
20 * @since 1.9.6
21 */
22 public function __construct() {
23
24 add_action( 'init', array( $this, 'init' ), 10, 1 );
25
26 }
27
28 /**
29 * Register ConvertKit shortcodes.
30 *
31 * @since 1.9.6
32 */
33 public function init() {
34
35 // Get shortcodes.
36 $shortcodes = convertkit_get_shortcodes();
37
38 // Bail if no shortcodes are available.
39 if ( ! count( $shortcodes ) ) {
40 return;
41 }
42
43 // Iterate through shortcodes, registering them as shortcodes.
44 foreach ( $shortcodes as $shortcode => $properties ) {
45 // Register shortcode.
46 add_shortcode(
47 'convertkit_' . $shortcode,
48 array(
49 $properties['render_callback'][0],
50 $properties['render_callback'][1],
51 )
52 );
53
54 // For the Form shortcode, register the [convertkit] shortcode for backward compatibility.
55 if ( $shortcode === 'form' ) {
56 add_shortcode(
57 'convertkit',
58 array(
59 $properties['render_callback'][0],
60 $properties['render_callback'][1],
61 )
62 );
63 }
64 }
65
66 }
67
68 }
69