-
Notifications
You must be signed in to change notification settings - Fork 0
/
functions.php
65 lines (57 loc) · 1.93 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
<?php
/**
* Gnuplotting.org
**/
/* Sidebar */
if ( function_exists('register_sidebar') ) {
register_sidebar(array(
'before_widget' => '<li id="%1$s" class="widget %2$s">',
'after_widget' => '</li>',
'before_title' => '<h2 class="widgettitle">',
'after_title' => '</h2>',
));
}
/* Tags in the sidebar */
function custom_tag_cloud_widget($args) {
$args['number'] = 0; //adding a 0 will display all tags
$args['largest'] = 14; //largest tag
$args['smallest'] = 8; //smallest tag
$args['unit'] = 'pt'; //tag font unit
return $args;
}
add_filter( 'widget_tag_cloud_args', 'custom_tag_cloud_widget' );
/* Pagination */
function pagination($pages = '', $range = 4)
{
$showitems = ($range * 2)+1;
global $paged;
if(empty($paged)) $paged = 1;
if($pages == '')
{
global $wp_query;
$pages = $wp_query->max_num_pages;
if(!$pages)
{
$pages = 1;
}
}
if(1 != $pages)
{
echo "<div class=\"pagination\">";
echo "<ul>";
if($paged == 1) echo "<li class=\"prev disabled\"><a href=\"#\">‹ Previous</a></li>";
if($paged > 1) echo "<li class=\"prev\"><a href=\"".get_pagenum_link($paged - 1)."\">‹ Previous</a></li>";
for ($i=1; $i <= $pages; $i++)
{
if (1 != $pages &&( !($i >= $paged+$range+1 || $i <= $paged-$range-1) || $pages <= $showitems ))
{
echo ($paged == $i)? "<li class=\"active\"><a href=\"#\">".$i."</a></li>":"<li><a href='".get_pagenum_link($i)."' class=\"inactive\">".$i."</a></li>";
}
}
if($paged < $pages) echo "<li class=\"next\"><a href=\"".get_pagenum_link($paged + 1)."\">Next ›</a></li>";
if($paged == $pages) echo "<li class=\"next disabled\"><a href=\"#\">Next ›</a></li>";
echo "</ul>";
echo "</div>\n";
}
}
?>