PluginProbe
Powerkit – Supercharge your WordPress Site / 2.4.4
Powerkit – Supercharge your WordPress Site v2.4.4
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 / pinterest / public / class-powerkit-pinterest-shortcode.php

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

113 lines 2.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Shortcodes Pinterest
4 *
5 * @link https://codesupply.co
6 * @since 1.0.0
7 *
8 * @package PowerKit
9 * @subpackage PowerKit/shortcodes
10 */
11
12 /**
13 * Pinterest Board 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_pinterest_board_shortcode( $atts, $content = '' ) {
20
21 $params = powerkit_shortcode_atts( shortcode_atts( array(
22 'href' => '',
23 ), $atts ) );
24
25 ob_start();
26
27 if ( $params['href'] ) {
28 ?>
29 <div class="pinterest-board-wrapper">
30 <a data-pin-do="embedBoard" data-pin-board-width="100%" href="<?php echo esc_attr( $params['href'] ); ?>"></a>
31 </div>
32 <?php
33 } else {
34 powerkit_alert_warning( esc_html__( 'The "Pinterest Board URL" field is required!', 'powerkit' ) );
35 }
36
37 return ob_get_clean();
38 }
39 add_shortcode( 'powerkit_pinterest_board', 'powerkit_pinterest_board_shortcode' );
40
41 /**
42 * Map Pinterest Board Shortcode into the Basic Shortcodes Plugin
43 */
44 if ( function_exists( 'powerkit_basic_shortcodes_register' ) ) :
45
46 powerkit_basic_shortcodes_register( array(
47 'name' => 'pinterest_board',
48 'title' => esc_html__( 'Pinterest Board', 'powerkit' ),
49 'priority' => 150,
50 'base' => 'powerkit_pinterest_board',
51 'autoregister' => false,
52 'fields' => array(
53 array(
54 'type' => 'input',
55 'name' => 'href',
56 'label' => esc_html__( 'Pinterest board URL', 'powerkit' ),
57 ),
58 ),
59 ) );
60
61 endif;
62
63 /**
64 * Pinterest Profile Shortcode
65 *
66 * @param array $atts User defined attributes in shortcode tag.
67 * @param string $content Shorcode tag content.
68 * @return string Shortcode result HTML.
69 */
70 function powerkit_pinterest_profile_shortcode( $atts, $content = '' ) {
71
72 $params = powerkit_shortcode_atts( shortcode_atts( array(
73 'href' => '',
74 ), $atts ) );
75
76 ob_start();
77
78 if ( $params['href'] ) {
79 ?>
80 <div class="pinterest-profile-wrapper">
81 <a data-pin-do="embedUser" data-pin-board="100%" href="<?php echo esc_attr( $params['href'] ); ?>"></a>
82 </div>
83 <?php
84 } else {
85 powerkit_alert_warning( esc_html__( 'The "Pinterest Profile URL" field is required!', 'powerkit' ) );
86 }
87
88 return ob_get_clean();
89 }
90 add_shortcode( 'powerkit_pinterest_profile', 'powerkit_pinterest_profile_shortcode' );
91
92 /**
93 * Map Pinterest Profile Shortcode into the Basic Shortcodes Plugin
94 */
95 if ( function_exists( 'powerkit_basic_shortcodes_register' ) ) :
96
97 powerkit_basic_shortcodes_register( array(
98 'name' => 'pinterest_profile',
99 'title' => esc_html__( 'Pinterest Profile', 'powerkit' ),
100 'priority' => 150,
101 'base' => 'powerkit_pinterest_profile',
102 'autoregister' => false,
103 'fields' => array(
104 array(
105 'type' => 'input',
106 'name' => 'href',
107 'label' => esc_html__( 'Pinterest profile URL', 'powerkit' ),
108 ),
109 ),
110 ) );
111
112 endif;
113