-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathshortcodes.php
More file actions
executable file
·92 lines (72 loc) · 2.41 KB
/
shortcodes.php
File metadata and controls
executable file
·92 lines (72 loc) · 2.41 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
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
<?php
//////////////////////////////////////////////////////////
// Button
// example. [btn size='sm' type='info' link='http://devdm.com' icon="glyphicon-heart"] Go To the DevDm.com Website [/btn]
//////////////////////////////////////////////////////////
if (!function_exists('btn_func')) {
function btn_func($atts, $content = NULL) {
extract( shortcode_atts( array(
'size' => '',
'type' => '',
'link' => '#',
'icon' => ''
), $atts));
if ($size != '') {
$size = ' btn-' . $size;
} else {
$size = ' btn-default';
}
if ($icon != '') {
$icon = '<span class="glyphicon '. $icon .'"></span>';
}
if ($type != '') {
$type = ' btn-' . $type;
} else {
$type = 'btn-default';
}
$btn = "<a href='". $link ."' class='btn" . $size . "" . $type. "'>" . $icon . $content . "</a>";
return $btn;
}
add_shortcode('btn', 'btn_func');
}
//////////////////////////////////////////////////////////
// Alert Box
// example. [alert type='info' dismiss='yes' size='3' title='Alert Block Title'] Go To the DevDm.com Website [/alert]
//////////////////////////////////////////////////////////
if (!function_exists('alert_func')) {
function alert_func($atts, $content = NULL) {
extract( shortcode_atts( array(
'type' => '',
'dismiss' => '',
'size' => '',
'title' => ''
), $atts));
if ($dismiss == 'yes') {
$dismiss = "data-dismiss='alert'";
$dismisslink ="<a class='close'>×</a>";
} else {
$dismiss = '';
$dismisslink = '';
}
if ($title != '') {
$title = "<h4 class='alert-heading'>".$title."</h4>";
$block = " alert-block ";
} else {
$title = "";
$block = "";
}
if ($type != '') {
$type = " alert-" . $type ." ";
}
if ($size != '') {
$size = " col-md-" . $size;
}
$alert = "<div class='alert". $block ."". $type ."". $size ."'". $dismiss .">";
$alert .= $dismisslink . $title;
$alert .= "<p>". $content . "</p>";
$alert .= "</div>";
return $alert;
}
add_shortcode('alert', 'alert_func');
}
add_filter('widget_text', 'do_shortcode');