/
functions.php
71 lines (56 loc) · 2.03 KB
/
functions.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
71
<?php
@include('version.php');
function tarski_site_version_shortcode($attrs) {
if (is_array($attrs)) extract($attrs);
if (defined('TARSKI_RELEASE_VERSION') && empty($number))
$number = TARSKI_RELEASE_VERSION;
if (defined('TARSKI_RELEASE_LINK') && empty($link))
$link = TARSKI_RELEASE_LINK;
return <<<VERSION
<p><small>
The latest Tarski release is <a href="$link">$number</a>
(<a href="http://tarskitheme.com/about/changelog/#v$number">?</a>).
</small></p>
<p><a class="download"
href="http://tarskitheme.com/downloads/tarski_$number.zip">
Download Tarski $number
</a></p>
<p><small>
A <a href="http://github.com/beastaugh/tarski">Git repository</a>
is also available.
</small></p>
VERSION;
}
function tarski_site_plugin_shortcode($attrs, $content) {
extract($attrs);
$name = trim($name);
$content = wpautop($content);
$nameLower = preg_replace('/[^a-z\d]/', '-', strtolower($name));
return <<<PLUGIN
<div class="plugin section" id="plugin-$nameLower">
<h4><a href="$link">$name</a></h4>
$content
</div>
PLUGIN;
}
function tarski_site_comment_guidelines() {
print <<<GUIDELINES
<div class="content">
<h3>Commenting Guidelines and Tips</h3>
<p>
HTML enclosed in <code><code></code> tags will be automatically
escaped—don’t worry about replacing <code><</code> with
<code>&lt;</code>, for example.</p>
</div>
GUIDELINES;
}
add_shortcode('version', 'tarski_site_version_shortcode');
add_shortcode('plugin', 'tarski_site_plugin_shortcode');
add_action('comment_form', 'tarski_site_comment_guidelines');
/**
* A hack to make text widgets parse shortcodes.
*
* See WP bug ticket #10457
* http://core.trac.wordpress.org/ticket/10457
*/
add_filter('widget_text', 'do_shortcode', 11);