forked from milohuang/reverie
-
Notifications
You must be signed in to change notification settings - Fork 0
/
functions.php
executable file
·112 lines (99 loc) · 3.99 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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
<?php
/*
Author: Zhen Huang
URL: http://themefortress.com/
This place is much cleaner. Put your theme specific codes here,
anything else you may want to use plugins to keep things tidy.
*/
/*
1. lib/clean.php
- head cleanup
- post and images related cleaning
*/
require_once('lib/clean.php'); // do all the cleaning and enqueue here
/*
2. lib/enqueue-style.php
- enqueue Foundation and Reverie CSS
*/
require_once('lib/enqueue-style.php');
/*
3. lib/foundation.php
- add pagination
*/
require_once('lib/foundation.php'); // load Foundation specific functions like top-bar
/*
4. lib/nav.php
- custom walker for top-bar and related
*/
require_once('lib/nav.php'); // filter default wordpress menu classes and clean wp_nav_menu markup
/*
5. lib/presstrends.php
- add PressTrends, tracks how many people are using Reverie
*/
require_once('lib/presstrends.php'); // load PressTrends to track the usage of Reverie across the web, comment this line if you don't want to be tracked
/**********************
Add theme supports
**********************/
if( ! function_exists( 'reverie_theme_support' ) ) {
function reverie_theme_support() {
// Add language supports.
load_theme_textdomain('reverie', get_template_directory() . '/lang');
// Add post thumbnail supports. http://codex.wordpress.org/Post_Thumbnails
add_theme_support('post-thumbnails');
// set_post_thumbnail_size(150, 150, false);
add_image_size('fd-lrg', 1024, 99999);
add_image_size('fd-med', 768, 99999);
add_image_size('fd-sm', 320, 9999);
// rss thingy
add_theme_support('automatic-feed-links');
// Add post formats support. http://codex.wordpress.org/Post_Formats
add_theme_support('post-formats', array('aside', 'gallery', 'link', 'image', 'quote', 'status', 'video', 'audio', 'chat'));
// Add menu support. http://codex.wordpress.org/Function_Reference/register_nav_menus
add_theme_support('menus');
register_nav_menus(array(
'primary' => __('Primary Navigation', 'reverie'),
'additional' => __('Additional Navigation', 'reverie'),
'utility' => __('Utility Navigation', 'reverie')
));
// Add custom background support
add_theme_support( 'custom-background',
array(
'default-image' => '', // background image default
'default-color' => '', // background color default (dont add the #)
'wp-head-callback' => '_custom_background_cb',
'admin-head-callback' => '',
'admin-preview-callback' => ''
)
);
}
}
add_action('after_setup_theme', 'reverie_theme_support'); /* end Reverie theme support */
// create widget areas: sidebar, footer
$sidebars = array('Sidebar');
foreach ($sidebars as $sidebar) {
register_sidebar(array('name'=> $sidebar,
'id' => 'Sidebar',
'before_widget' => '<article id="%1$s" class="panel widget %2$s">',
'after_widget' => '</article>',
'before_title' => '<h4>',
'after_title' => '</h4>'
));
}
$sidebars = array('Footer');
foreach ($sidebars as $sidebar) {
register_sidebar(array('name'=> $sidebar,
'id' => 'Footer',
'before_widget' => '<div class="large-3 columns"><article id="%1$s" class="panel widget %2$s">',
'after_widget' => '</article></div>',
'before_title' => '<h4>',
'after_title' => '</h4>'
));
}
// return entry meta information for posts, used by multiple loops, you can override this function by defining them first in your child theme's functions.php file
if ( ! function_exists( 'reverie_entry_meta' ) ) {
function reverie_entry_meta() {
echo '<span class="byline author">'. __('Written by', 'reverie') .' <a href="'. get_author_posts_url(get_the_author_meta('ID')) .'" rel="author" class="fn">'. get_the_author() .', </a></span>';
echo '<time class="updated" datetime="'. get_the_time('c') .'" pubdate>'. get_the_time('F jS, Y') .'</time>';
}
};
?>