-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfunctions.php
278 lines (225 loc) · 8.15 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
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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
<?php
/**
* Tell WordPress to run foghorn_setup() when the 'after_setup_theme' hook is run.
*/
add_action( 'after_setup_theme', 'foghorn_setup' );
if ( ! function_exists( 'foghorn_setup' ) ):
/**
* Sets up theme defaults and registers support for various WordPress features.
*
* Note that this function is hooked into the after_setup_theme hook, which runs
* before the init hook. The init hook is too late for some features, such as indicating
* support post thumbnails.
*
* To override foghorn_setup() in a child theme, add your own foghorn_setup to your child theme's
* functions.php file.
*
* @uses load_theme_textdomain() For translation/localization support.
* @uses add_editor_style() To style the visual editor.
* @uses add_theme_support() To add support for post thumbnails and automatic feed links.
* @uses register_nav_menus() To add support for navigation menus.
* @uses add_custom_background() To add support for a custom background.
* @uses set_post_thumbnail_size() To set a custom post thumbnail size.
*
* @since Foghorn 0.1
*/
function foghorn_setup() {
/**
* Set the content width based on the theme's design and stylesheet.
*/
if ( ! isset( $content_width ) )
$content_width = 560;
// Make Foghorn translatable
load_theme_textdomain( 'foghorn', TEMPLATEPATH . '/languages' );
$locale = get_locale();
$locale_file = TEMPLATEPATH . "/languages/$locale.php";
if ( is_readable( $locale_file ) )
require_once( $locale_file );
// Styles the visual editor with editor-style.css to match the theme style
add_editor_style();
// Add default posts and comments RSS feed links to <head>.
add_theme_support( 'automatic-feed-links' );
// This theme uses wp_nav_menu() in one location.
register_nav_menu( 'primary', __( 'Primary Menu', 'foghorn' ) );
// Adds support for custom backgrounds
add_custom_background();
// Adds theme support for thumbnails
add_theme_support( 'post-thumbnails' );
// Creates an image thumbnail size for multiple displays
add_image_size( 'multiple-thumb', 325, 205, true );
// Sets up the option panel functions
require_once(TEMPLATEPATH . '/extensions/options-functions.php');
}
endif; // foghorn_setup
/**
* Sets the post excerpt length to 40 characters.
*/
function foghorn_excerpt_length( $length ) {
return 40;
}
add_filter( 'excerpt_length', 'foghorn_excerpt_length' );
/**
* Returns a "Continue Reading" link for excerpts
*/
function foghorn_continue_reading_link() {
return ' <a href="'. get_permalink() . '">' . __( 'Continue reading <span class="meta-nav">→</span>', 'foghorn' ) . '</a>';
}
/**
* Replaces "[...]" (appended to automatically generated excerpts) with an ellipsis and foghorn_continue_reading_link().
*
*/
function foghorn_auto_excerpt_more( $more ) {
return ' …' . foghorn_continue_reading_link();
}
add_filter( 'excerpt_more', 'foghorn_auto_excerpt_more' );
/**
* Adds a pretty "Continue Reading" link to custom post excerpts.
*
* To override this link in a child theme, remove the filter and add your own
* function tied to the get_the_excerpt filter hook.
*/
function foghorn_custom_excerpt_more( $output ) {
if ( has_excerpt() && ! is_attachment() ) {
$output .= foghorn_continue_reading_link();
}
return $output;
}
add_filter( 'get_the_excerpt', 'foghorn_custom_excerpt_more' );
/**
* Adds custom body for singular vs multiple layouts
*/
/**
* Registers the sidebars and widgetized areas.
*
* @since Foghorn 0.1
*/
function foghorn_widgets_init() {
register_sidebar( array(
'name' => __( 'Sidebar', 'foghorn' ),
'id' => 'sidebar',
'description' => __( 'The right sidebar for posts and pages.', 'foghorn' ),
'before_widget' => '<aside id="%1$s" class="widget %2$s">',
'after_widget' => "</aside>",
'before_title' => '<h1 class="widget-title">',
'after_title' => '</h1>',
) );
register_sidebar( array(
'name' => __( 'Footer-left', 'foghorn' ),
'id' => 'footer-left',
'description' => __( 'The left footer widgets posts and pages.', 'foghorn' ),
'before_widget' => '<aside id="%1$s" class="widget %2$s">',
'after_widget' => "</aside>",
'before_title' => '<h3 class="footer-title">',
'after_title' => '</h3>',
) );
register_sidebar( array(
'name' => __( 'Footer-middle', 'foghorn' ),
'id' => 'footer-middle',
'description' => __( 'The middle footer widgets for posts and pages.', 'foghorn' ),
'before_widget' => '<aside id="%1$s" class="widget %2$s">',
'after_widget' => "</aside>",
'before_title' => '<h3 class="footer-title">',
'after_title' => '</h3>',
) );
register_sidebar( array(
'name' => __( 'Footer-right', 'foghorn' ),
'id' => 'footer-right',
'description' => __( 'The right footer widgets for posts and pages.', 'foghorn' ),
'before_widget' => '<aside id="%1$s" class="widget %2$s">',
'after_widget' => "</aside>",
'before_title' => '<h3 class="footer-title">',
'after_title' => '</h3>',
) );
}
add_action( 'widgets_init', 'foghorn_widgets_init' );
/**
* Display navigation to next/previous pages when applicable
*/
function foghorn_content_nav( $nav_id ) {
global $wp_query;
if ( $wp_query->max_num_pages > 1 ) : ?>
<nav id="<?php echo $nav_id; ?>">
<h1 class="section-heading"><?php _e( 'Post navigation', 'foghorn' ); ?></h1>
<div class="nav-previous"><?php next_posts_link( __( '<span class="meta-nav">←</span> Older posts', 'foghorn' ) ); ?></div>
<div class="nav-next"><?php previous_posts_link( __( 'Newer posts <span class="meta-nav">→</span>', 'foghorn' ) ); ?></div>
</nav><!-- #nav-above -->
<?php endif;
}
/**
* Comments
*/
if ( ! function_exists( 'foghorn_comment' ) ) :
/**
* Template for comments and pingbacks.
*
* Used as a callback by wp_list_comments() for displaying the comments.
*
* @since Foghorn 0.1
*/
function foghorn_comment( $comment, $args, $depth ) {
$GLOBALS['comment'] = $comment;
switch ( $comment->comment_type ) :
case 'pingback' :
case 'trackback' :
?>
<li class="post pingback">
<p><?php _e( 'Pingback:', 'foghorn' ); ?> <?php comment_author_link(); ?><?php edit_comment_link( __( '(Edit)', 'foghorn' ), ' ' ); ?></p>
<?php
break;
default :
?>
<li <?php comment_class(); ?> id="li-comment-<?php comment_ID(); ?>">
<article id="comment-<?php comment_ID(); ?>" class="comment">
<footer class="comment-meta">
<div class="comment-author vcard">
<?php
$avatar_size = 60;
if ( '0' != $comment->comment_parent )
$avatar_size = 40;
echo get_avatar( $comment, $avatar_size );
printf( __( '%1$s on %2$s%3$s at %4$s%5$s <span class="says">said:</span>', 'foghorn' ),
sprintf( '<cite class="fn">%s</cite>', get_comment_author_link() ),
'<a href="' . esc_url( get_comment_link( $comment->comment_ID ) ) . '"><time pubdate datetime="' . get_comment_time( 'c' ) . '">',
get_comment_date(),
get_comment_time(),
'</time></a>'
);
?>
<?php edit_comment_link( __( '[Edit]', 'foghorn' ), ' ' ); ?>
</div><!-- .comment-author .vcard -->
<?php if ( $comment->comment_approved == '0' ) : ?>
<em class="comment-awaiting-moderation"><?php _e( 'Your comment is awaiting moderation.', 'foghorn' ); ?></em>
<br />
<?php endif; ?>
</footer>
<div class="comment-content"><?php comment_text(); ?></div>
<div class="reply">
<?php comment_reply_link( array_merge( $args, array( 'reply_text' => __( 'Reply ↓', 'foghorn' ), 'depth' => $depth, 'max_depth' => $args['max_depth'] ) ) ); ?>
</div><!-- .reply -->
</article><!-- #comment-## -->
<?php
break;
endswitch;
}
endif; // ends check for foghorn_comment()
/// ADDED ///
global $os_regionToState;
$os_regionToState = array(
'rockaways' => 'NY',
'lower east side' => 'NY',
);
require_once('extensions/fusion/occupysandybackend.php');
require_once('extensions/fusion/occupysandyfrontend.php');
/*
function theme_enqueue_less() {
wp_enqueue_style('myCss', get_bloginfo('template_directory').'/style.less', array(), '0.7', 'screen, projection');
}
add_action('wp','theme_enqueue_less');
*/
function add_fonts() {
?>
<!-- webfonts -->
<link href='http://fonts.googleapis.com/css?family=Open+Sans:400italic,700italic,400,700' rel='stylesheet' type='text/css'>
<?php
}
add_action('wp_head','add_fonts');