-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcode.php
More file actions
44 lines (37 loc) · 1.31 KB
/
code.php
File metadata and controls
44 lines (37 loc) · 1.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?php
/**
* Shortcode for outputing "Power Builder" layouts where plugin is not availible
*/
function render_builder_layout_shortcode( $atts=array() ){
$content = '';
$atts = shortcode_atts(
array(
'id' => '',
), $atts, 'builder_layout'
);
if( '' != $atts['id'] ){
$layout = get_post($atts['id']);
if( $layout ){
$content .= apply_filters( 'the_content', $layout->post_content );
}
}
$outer_classes = implode( ' ', apply_filters( 'tm_builder_outer_content_class', array(
'tm_builder_outer_content'
) ) );
$inner_classes = implode( ' ', apply_filters( 'tm_builder_inner_content_class', array(
'tm_builder_inner_content'
) ) );
return sprintf(
'<div class="%1$s" id="%2$s">
<div class="%3$s">
%4$s
</div>
</div>',
esc_attr( $outer_classes ),
esc_attr( apply_filters( 'tm_builder_outer_content_id', 'tm_builder_outer_content' ) ),
esc_attr( $inner_classes ),
$content
);
}
add_shortcode( 'builder_layout', 'render_builder_layout_shortcode' );
add_filter( 'widget_text', 'do_shortcode' );