/
shortcodes.php
52 lines (44 loc) · 1.75 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
<?php
/**
* Big Blank Custom Shortcodes
* @link http://codex.wordpress.org/Shortcode_API
*/
/**
* A simple button shortcode, with option to pass link and additional class
* You can pass your custom classes or font awesome icons.
* @link http://fontawesome.io/icons/
* [button link="http://bigemployee.com/" class="big fa-angle-right"]Big Employee[/button]
* @return: <a href="http://bigemployee.com/" class="button big fa-angle-right">Big Employee</a>
*/
function bigblank_add_shortcode_button($atts, $content = null) {
extract(
shortcode_atts(
array(
'link' => '#',
'class' => 'button',
), $atts));
return bigblank_render_button($content, $link, false, $class);
}
function bigblank_render_button($content = 'new link', $link = '#', $echo = true, $class = 'button') {
$class = strip_tags(trim($class));
if (strpos($class, 'button') === FALSE) {
$class = 'button ' . $class;
}
if (!$echo)
return '<a href="' . $link . '" class="' . $class . '">' . do_shortcode($content) . '</a>';
echo '<a href="' . $link . '" class="' . $class . '">' . do_shortcode($content) . '</a>';
}
add_shortcode('button', 'bigblank_add_shortcode_button');
/*
* Hide Email from Spam Bots using a short code place this in your functions file
* [email]john.doe@mysite.com[/email]
* Output: john.doe@mysite.com
*
* @link http://codex.wordpress.org/Function_Reference/antispambot
*/
function bigblank_hide_email($atts, $content = null) {
if (!is_email($content))
return;
return '<a href="mailto:' . antispambot($content) . '">' . antispambot($content) . '</a>';
}
add_shortcode('email', 'bigblank_hide_email');