-
Notifications
You must be signed in to change notification settings - Fork 0
/
functions.php
87 lines (69 loc) · 2.1 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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
<?php
/** register the sidebars */
$sidebarArgs = array(
'before_widget' => '<div id="%1$s" class="well widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h3 class="widgettitle">',
'after_title' => '</h3>' );
register_sidebars( 2, $sidebarArgs );
function pagination() {
global $wp_query;
$total = $wp_query->max_num_pages;
// only bother with the rest if we have more than 1 page!
if ( $total > 1 ) {
// get the current page
$curPage = (get_query_var('paged')) ? get_query_var('paged') : 1;
//loop all the pages
echo '<div class="pagination">';
$big = 999999999; // need an unlikely integer
echo paginate_links(
array(
'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),
'format' => '?paged=%#%',
'current' => max( 1, get_query_var('paged') ),
'total' => $wp_query->max_num_pages,
'type' => 'list'
)
);
echo '</div>';
}
}
function new_excerpt_more($more) {
global $post;
return '...<br/><a href="'. get_permalink($post->ID) . '">Read More</a>';
}
add_filter('excerpt_more', 'new_excerpt_more');
$theTemplateName='index';
function setTemplateName($name) {
global $theTemplateName;
$theTemplateName=$name;
}
function getTemplateName() {
global $theTemplateName;
return $theTemplateName;
}
//get the options for the ga plugin i'm using, this is to avoid hardcoding, the $GA_ACCOUNT variable.
$GA_OPTIONS = get_option( 'Yoast_Google_Analytics' );
// Copyright 2009 Google Inc. All Rights Reserved.
$GA_ACCOUNT = $GA_OPTIONS['uastring'];
$GA_PIXEL = "ga.php";
function googleAnalyticsGetImageUrl() {
global $GA_ACCOUNT, $GA_PIXEL;
$url = "";
$url .= $GA_PIXEL . "?";
$url .= "utmac=" . $GA_ACCOUNT;
$url .= "&utmn=" . rand(0, 0x7fffffff);
$referer = $_SERVER["HTTP_REFERER"];
$query = $_SERVER["QUERY_STRING"];
$path = $_SERVER["REQUEST_URI"];
if (empty($referer)) {
$referer = "-";
}
$url .= "&utmr=" . urlencode($referer);
if (!empty($path)) {
$url .= "&utmp=" . urlencode($path);
}
$url .= "&guid=ON";
return $url;
}
?>