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 / basic-elements / templates / separators.php

separators.php in Powerkit – Supercharge your WordPress Site 2.4.4, at modules/basic-elements/templates/separators.php

73 lines 1.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Shortcode Separators config
4 *
5 * @package Powerkit
6 * @subpackage Templates
7 */
8
9 /**
10 * Separators
11 */
12 powerkit_basic_shortcodes_register( array(
13 'name' => 'separators',
14 'title' => esc_html__( 'Separators', 'powerkit' ),
15 'priority' => 10,
16 'base' => 'powerkit_separator',
17 'autoregister' => true,
18 'fields' => array(
19 array(
20 'type' => 'section',
21 'label' => esc_html__( 'Options', 'powerkit' ),
22 ),
23 array(
24 'type' => 'radio',
25 'name' => 'style',
26 'label' => esc_html__( 'Style', 'powerkit' ),
27 'style' => 'vertical',
28 'default' => 'solid',
29 'options' => array(
30 'solid' => esc_html__( 'Solid', 'powerkit' ),
31 'double' => esc_html__( 'Double', 'powerkit' ),
32 'dotted' => esc_html__( 'Dotted', 'powerkit' ),
33 'dashed' => esc_html__( 'Dashed', 'powerkit' ),
34 'blank' => esc_html__( 'Blank (empty space)', 'powerkit' ),
35 ),
36 ),
37 array(
38 'type' => 'input',
39 'name' => 'height',
40 'label' => esc_html__( 'Height', 'powerkit' ),
41 'default' => '',
42 'suffix' => ' px',
43 ),
44 ),
45 ) );
46
47
48 /**
49 * Separator Shortcode
50 *
51 * @param array $output Shortcode HTML.
52 * @param array $atts User defined attributes in shortcode tag.
53 * @param string $content Shorcode tag content.
54 * @return string Shortcode result HTML.
55 */
56 function powerkit_basic_shortcodes_separator( $output, $atts, $content ) {
57
58 if ( 'blank' === $atts['style'] ) {
59 $inl_css = sprintf( 'style="height: %dpx;"', absint( $atts['height'] ) );
60 } else {
61 $inl_css = sprintf( 'style="border-bottom-width: %dpx; border-bottom-style: %s;"', absint( $atts['height'] ), $atts['style'] );
62 }
63
64 $output = sprintf(
65 '<div class="pk-separator" %s>%s</div>',
66 $inl_css,
67 $content
68 );
69
70 return $output;
71 }
72 add_filter( 'powerkit_separator_shortcode', 'powerkit_basic_shortcodes_separator', 10, 3 );
73