forked from bennuttall/acacia-acuminata
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfunctions.php
91 lines (73 loc) · 2.33 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
88
89
90
91
<?php
// Image sizes
set_post_thumbnail_size(100, 100);
add_image_size('friend_thumb', 100, 100, false);
// Menus
register_nav_menu('nav_bar', 'Nav Bar');
// Custom post types
add_action('init', 'create_friends_post_type');
function create_friends_post_type() {
register_post_type('friends',
array(
'labels' => array(
'name' => 'Friends',
'singular_name' => 'Friend',
'add_new' => 'Add New',
'add_new_item' => 'Add New Friend',
'edit_item' => 'Edit Friend',
'new_item' => 'New Friend',
'all_items' => 'All Friends',
'view_item' => 'View Friend',
'search_items' => 'Search Friends',
'not_found' => 'No Friends Found',
'not_found_in_trash' => 'No Friends found in Trash',
'menu_name' => 'Friends',
),
'public' => true,
'has_archive' => false,
'rewrite' => array('slug' => 'friend'),
'supports' => array('title', 'excerpt', 'thumbnail'),
)
);
add_theme_support('post-thumbnails', array('friends'));
}
// Custom functions
function timestamped_stylesheet($stylesheet='style.css') {
$stylesheet_url = get_bloginfo('template_url') . '/' . $stylesheet;
$stylesheet_path = get_stylesheet_directory() . '/' . $stylesheet;
echo $stylesheet_url . "?" . filemtime($stylesheet_path);
}
function show_tag_list ($id, $separator, $before) {
$tags = wp_get_post_tags($id);
if (!empty($tags)) {
$tags_html = array();
foreach ($tags as $tag) {
$tags_html[] = "<a href='/tag/{$tag->slug}/'>{$tag->name}</a>";
}
echo $before . join($separator, $tags_html);
}
}
function random_404_message() {
$random_1 = rand(0, 2);
$random_2 = rand(0, 2);
$words = array(
'Raspberry',
'Jam',
'Pi'
);
$word = $words[$random_1];
$messages = array(
"No {$word} here...",
"This is not the {$word} you are looking for...",
"The {$word} you requested could not be found",
);
echo $messages[$random_2];
}
function meta_description() {
if (is_single()) {
the_excerpt();
}
else {
echo "Manchester Raspberry Pi user group based at The Shed";
}
}