-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfunctions.php
More file actions
147 lines (123 loc) · 4.74 KB
/
functions.php
File metadata and controls
147 lines (123 loc) · 4.74 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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
<?php
// Add RSS links to <head> section
automatic_feed_links();
// Load jQuery
if ( !function_exists(core_mods) ) {
function core_mods() {
if ( !is_admin() ) {
wp_deregister_script('jquery');
wp_register_script('jquery', ("http://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js"), false);
wp_enqueue_script('jquery');
}
}
core_mods();
}
// Clean up the <head>
function removeHeadLinks() {
remove_action('wp_head', 'rsd_link');
remove_action('wp_head', 'wlwmanifest_link');
}
add_action('init', 'removeHeadLinks');
remove_action('wp_head', 'wp_generator');
if (function_exists('register_sidebar')) {
register_sidebar(array(
'name' => 'Sidebar Widgets',
'id' => 'sidebar-widgets',
'description' => 'These are widgets for the sidebar.',
'before_widget' => '<div id="%1$s" class="widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h4>',
'after_title' => '</h4>'
));
}
//
//
//
//
//
// Add the theme options
add_theme_support('post-thumbnails');
function register_my_menus() {
register_nav_menus(
array('header-menu' => __( 'Header Menu' ) )
);
}
add_action( 'init', 'register_my_menus' );
// remove parentheses from category list and add span class to post count
function categories_postcount_filter ($variable) {
$variable = str_replace('(', '<span class="post-count"> ', $variable);
$variable = str_replace(')', ' </span>', $variable);
return $variable;
}
add_filter('wp_list_categories','categories_postcount_filter');
function wordpressapi_comments($comment, $args, $depth) {
$GLOBALS['comment'] = $comment; ?>
<li <?php comment_class(); ?> id="li-comment-<?php comment_ID() ?>">
<div id="comment-<?php comment_ID(); ?>">
<div class="commentmetainfo clearfix">
<?php echo get_avatar($comment,$size='45',$default='http://localhost:8888/wordpress/wp-content/themes/HTML5-Reset-Compass-Sass-Wordpress-Theme/_/images/non-avatar.png' ); ?>
<?php $user_name_str = substr(get_comment_author(),0, 20); ?>
<?php printf(__('<cite>%s</cite>'), $user_name_str) ?>
<a class="commentdatelink" href="<?php echo htmlspecialchars( get_comment_link( $comment->comment_ID ) ) ?>"><?php printf(__('%1$s at %2$s'), comment_date('M j, Y'), get_comment_time()) ?></a>
<?php if ($comment->comment_approved == '0') : ?>
<span class="warning"><?php _e('Your comment is awaiting moderation.') ?></span>
<?php endif; ?>
<?php edit_comment_link(__('(Edit)'),' ','') ?>
</div>
<?php comment_text() ?>
<?php comment_reply_link(array_merge( $args, array('depth' => $depth, 'max_depth' => $args['max_depth']))) ?>
</div>
<?php
}
function publiclibrary_get_archives() {
global $wpdb, $wp_locale;
$output = '';
$query = "SELECT COUNT( ID ) posts, YEAR( post_date ) year, MONTH( post_date ) month
FROM wp_posts
WHERE post_status = 'publish'
GROUP BY month
HAVING year = YEAR( NOW( ) )
UNION
SELECT COUNT( ID ) , YEAR( post_date ) year, MONTH( post_date ) month
FROM wp_posts
WHERE post_status = 'publish'
GROUP BY month
HAVING year < YEAR( NOW( ) )";
$key = md5($query);
$cache = wp_cache_get( 'wp_get_archives' , 'general');
if ( !isset( $cache[ $key ] ) ) {
$arcresults = $wpdb->get_results($query);
$cache[ $key ] = $arcresults;
wp_cache_set( 'wp_get_archives', $cache, 'general' );
} else {
$arcresults = $cache[ $key ];
}
if ( $arcresults ) {
$afterafter = $after;
foreach ( (array) $arcresults as $arcresult ) {
$url = get_month_link( $arcresult->year, $arcresult->month );
/* translators: 1: month name, 2: 4-digit year */
$thismonth = substr($wp_locale->get_month($arcresult->month), 0, 3);
$text = sprintf(__('%1$s %2$d'), $thismonth, $arcresult->year);
if ($arcresult->posts == 1)
$text .= '<span class="post-count">' . $arcresult->posts.' post</span>' . $afterafter;
else
$text .= '<span class="post-count">' . $arcresult->posts.' posts</span>' . $afterafter;
//$output .= publiclibrary_archives_link($url, $text, $before, $after);
$output .= '<li>' . $before . '<a href="' . $url . '" title="Archives for ' . $wp_locale->get_month($arcresult->month) . '">' . $text . '</a>' . $after .'</li>';
}
echo $output;
}
}
//
//
//
//
//
add_theme_support( 'post-formats', array('aside', 'gallery', 'link', 'image', 'quote', 'status', 'audio', 'chat', 'video')); // Add 3.1 post format theme support.
// Define Theme Constants
define('HOMEPATH', get_bloginfo('url'));
define('THEMEPATH', get_stylesheet_directory_uri());
define('IMAGESPATH', THEMEPATH . '/_/images/');
define('JAVASCRIPTSPATH', THEMEPATH . '/_/javascripts/');
?>