-
Notifications
You must be signed in to change notification settings - Fork 0
/
shortcodes.php
70 lines (64 loc) · 1.54 KB
/
shortcodes.php
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<?php
function skgriddler($atts,$content = null){
extract(shortcode_atts(array('class'=>'','columns'=>'') ,$atts) );
$skeleton = null;
if( ctype_alnum($columns) ):
$columns = (int)$columns;
switch($columns){
case 1: $skeleton = "one";
break;
case 2: $skeleton = "two";
break;
case 3: $skeleton = "three";
break;
case 4: $skeleton = "four";
break;
case 5: $skeleton = "five";
break;
case 6: $skeleton = "six";
break;
case 7: $skeleton = "seven";
break;
case 8: $skeleton = "eight";
break;
case 9: $skeleton = "nine";
break;
case 10: $skeleton = "ten";
break;
case 11: $skeleton = "eleven";
break;
case 12: $skeleton = "twelve";
break;
case 13: $skeleton = "thirteen";
break;
case 14: $skeleton = "fourteen";
break;
case 15: $skeleton = "fifteen";
break;
case 16: $skeleton = "sixteen";
break;
default: return "";
}
$skeleton .= " columns";
if( isset($class) ):
return "<div class='$skeleton'><div class='$class'>".do_shortcode( $content )."</div></div>";
endif;
return "<div class='$columns'>".do_shortcode( $content )."</div>";
endif;
}
add_shortcode('skgrid','skgriddler');
function skclear($atts,$content = null){
return "<br class'clear'/>";
}
add_shortcode('clear','skclear');
function cleanup_shortcode_fix($content) {
$array = array (
'<p>[' => '[',
']</p>' => ']',
']<br />' => ']',
']<br>' => ']'
);
$content = strtr($content, $array);
return $content;
}
add_filter('the_content', 'cleanup_shortcode_fix',10);