Skip to content

Commit fcdf7bd

Browse files
Drew MorrisDrew Morris
Drew Morris
authored and
Drew Morris
committed
Fixes
1 parent ed1c6eb commit fcdf7bd

8 files changed

+9685
-187
lines changed

content-page.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
*/
1111
?>
1212

13-
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?> >
14-
13+
<article id="page-<?php the_ID(); ?>" <?php post_class(); ?>>
14+
1515
<header>
1616
<h2><?php the_title(); ?></h2>
1717
</header>

content-single.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
*/
1111
?>
1212

13-
<article>
13+
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
1414

1515
<header>
1616
<hgroup>

content.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,12 @@
1010
*/
1111
?>
1212

13-
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?> >
13+
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
1414

1515
<header>
1616
<hgroup>
1717
<h3><a href="<?php the_permalink(); ?>" title="<?php echo esc_attr( sprintf( __( 'Permalink to %s', 'foundation' ), the_title_attribute( 'echo=0' ) ) ); ?>" rel="bookmark"><?php the_title(); ?></a></h3>
18+
<?php if ( is_sticky() ) : ?><span class="right radius secondary label"><?php _e( 'Sticky', 'foundation' ); ?></span><?php endif; ?>
1819
<h6>Written by <?php the_author_link(); ?> on <?php the_time(get_option('date_format')); ?></h6>
1920
</hgroup>
2021
</header>

functions.php

+68-158
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
* Initiate Foundation, for WordPress
1515
*/
1616

17+
if ( ! function_exists( 'foundation_setup' ) ) :
18+
1719
function foundation_setup() {
1820

1921
// Language Translations
@@ -43,23 +45,31 @@ function foundation_setup() {
4345
) );
4446

4547
}
48+
4649
add_action( 'after_setup_theme', 'foundation_setup' );
4750

51+
endif;
52+
4853
/**
4954
* Enqueue Scripts and Styles for Front-End
5055
*/
5156

57+
if ( ! function_exists( 'foundation_assets' ) ) :
58+
5259
function foundation_assets() {
5360

5461
if (!is_admin()) {
5562

63+
/**
64+
* Deregister jQuery in favour of ZeptoJS
65+
* jQuery will be used as a fallback if ZeptoJS is not compatible
66+
* @see foundation_compatibility & http://foundation.zurb.com/docs/javascript.html
67+
*/
5668
wp_deregister_script('jquery');
5769

5870
// Load JavaScripts
59-
wp_enqueue_script( 'foundation', get_template_directory_uri() . '/js/foundation.min.js', array('zepto'), '4.0', true );
60-
wp_enqueue_script('foundation-init', get_template_directory_uri().'/js/foundation-init.js', array(), false, true);
71+
wp_enqueue_script( 'foundation', get_template_directory_uri() . '/js/foundation.min.js', null, '4.0', true );
6172
wp_enqueue_script( 'modernizr', get_template_directory_uri().'/js/vendor/custom.modernizr.js', null, '2.1.0');
62-
wp_enqueue_script( 'zepto', get_template_directory_uri().'/js/vendor/zepto.js', null, '2.1.0', true);
6373

6474
// Load Stylesheets
6575
wp_enqueue_style( 'normalize', get_template_directory_uri().'/css/normalize.css' );
@@ -75,25 +85,50 @@ function foundation_assets() {
7585

7686
add_action( 'wp_enqueue_scripts', 'foundation_assets' );
7787

78-
<<<<<<< HEAD
79-
8088
endif;
81-
=======
89+
8290
/**
8391
* Initialise Foundation JS
92+
* @see: http://foundation.zurb.com/docs/javascript.html
8493
*/
8594

86-
function foundationjs () {
95+
if ( ! function_exists( 'foundation_js_init' ) ) :
96+
97+
function foundation_js_init () {
8798
echo '<script>$(document).foundation();</script>';
8899
}
89100

90-
add_action('wp_footer', 'foundationjs',100);
91-
>>>>>>> Fixes
101+
add_action('wp_footer', 'foundation_js_init', 50);
102+
103+
endif;
104+
105+
/**
106+
* ZeptoJS and jQuery Fallback
107+
* @see: http://foundation.zurb.com/docs/javascript.html
108+
*/
109+
110+
if ( ! function_exists( 'foundation_comptability' ) ) :
111+
112+
function foundation_comptability () {
113+
114+
echo "<script>";
115+
echo "document.write('<script src=' +";
116+
echo "('__proto__' in {} ? '" . get_template_directory_uri() . "/js/vendor/zepto" . "' : '" . get_template_directory_uri() . "/js/vendor/jquery" . "') +";
117+
echo "'.js><\/script>')";
118+
echo "</script>";
119+
120+
}
121+
122+
add_action('wp_footer', 'foundation_comptability', 10);
123+
124+
endif;
92125

93126
/**
94127
* Register Navigation Menus
95128
*/
96129

130+
if ( ! function_exists( 'foundation_menus' ) ) :
131+
97132
// Register wp_nav_menus
98133
function foundation_menus() {
99134

@@ -104,9 +139,13 @@ function foundation_menus() {
104139
);
105140

106141
}
142+
107143
add_action( 'init', 'foundation_menus' );
108144

109-
// Create a graceful fallback to wp_page_menu
145+
endif;
146+
147+
if ( ! function_exists( 'foundation_page_menu' ) ) :
148+
110149
function foundation_page_menu() {
111150

112151
$args = array(
@@ -124,11 +163,12 @@ function foundation_page_menu() {
124163

125164
}
126165

166+
endif;
167+
127168
/**
128169
* Navigation Menu Adjustments
129170
*/
130171

131-
132172
// Add class to navigation sub-menu
133173
class foundation_navigation extends Walker_Nav_Menu {
134174

@@ -150,6 +190,8 @@ function display_element( $element, &$children_elements, $max_depth, $depth=0, $
150190
* Create pagination
151191
*/
152192

193+
if ( ! function_exists( 'foundation_pagination' ) ) :
194+
153195
function foundation_pagination() {
154196

155197
global $wp_query;
@@ -174,10 +216,14 @@ function foundation_pagination() {
174216

175217
}
176218

219+
endif;
220+
177221
/**
178222
* Register Sidebars
179223
*/
180224

225+
if ( ! function_exists( 'foundation_widgets' ) ) :
226+
181227
function foundation_widgets() {
182228

183229
// Sidebar Right
@@ -239,40 +285,30 @@ function foundation_widgets() {
239285

240286
add_action( 'widgets_init', 'foundation_widgets' );
241287

242-
/**
243-
* HTML5 IE Shim
244-
*/
245-
246-
function foundation_shim () {
247-
echo '<!--[if lt IE 9]>';
248-
echo '<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>';
249-
echo '<![endif]-->';
250-
}
251-
252-
add_action('wp_head', 'foundation_shim');
288+
endif;
253289

254290
/**
255291
* Custom Avatar Classes
256292
*/
257293

294+
if ( ! function_exists( 'foundation_avatar_css' ) ) :
295+
258296
function foundation_avatar_css($class) {
259297
$class = str_replace("class='avatar", "class='author_gravatar left ", $class) ;
260298
return $class;
261299
}
262300

263301
add_filter('get_avatar','foundation_avatar_css');
264302

303+
endif;
304+
265305
/**
266306
* Custom Post Excerpt
267307
*/
268308

269-
<<<<<<< HEAD
270309
if ( ! function_exists( 'foundation_excerpt' ) ) :
271-
function improved_trim_excerpt($text) {
272310

273-
=======
274311
function foundation_excerpt($text) {
275-
>>>>>>> Fixes
276312
global $post;
277313
if ( '' == $text ) {
278314
$text = get_the_content('');
@@ -284,7 +320,7 @@ function foundation_excerpt($text) {
284320
$words = explode(' ', $text, $excerpt_length + 1);
285321
if (count($words)> $excerpt_length) {
286322
array_pop($words);
287-
array_push($words, '<br><br><a href="'.get_permalink($post->ID) .'" class="button secondary small">Continue Reading</a>');
323+
array_push($words, '<br><br><a href="'.get_permalink($post->ID) .'" class="button secondary small">' . __('Continue Reading', 'foundation') . '</a>');
288324
$text = implode(' ', $words);
289325
}
290326
}
@@ -294,68 +330,8 @@ function foundation_excerpt($text) {
294330
remove_filter('get_the_excerpt', 'wp_trim_excerpt');
295331
add_filter('get_the_excerpt', 'foundation_excerpt');
296332

297-
/**
298-
* Comments Template
299-
*/
300-
301-
if ( ! function_exists( 'foundation_comment' ) ) :
302-
303-
function foundation_comment( $comment, $args, $depth ) {
304-
$GLOBALS['comment'] = $comment;
305-
switch ( $comment->comment_type ) :
306-
case 'pingback' :
307-
case 'trackback' :
308-
// Display trackbacks differently than normal comments.
309-
?>
310-
<li <?php comment_class(); ?> id="comment-<?php comment_ID(); ?>">
311-
<p><?php _e( 'Pingback:', 'foundation' ); ?> <?php comment_author_link(); ?> <?php edit_comment_link( __( '(Edit)', 'foundation' ), '<span>', '</span>' ); ?></p>
312-
<?php
313-
break;
314-
default :
315-
global $post;
316-
?>
317-
<li <?php comment_class(); ?> id="li-comment-<?php comment_ID(); ?>">
318-
<article id="comment-<?php comment_ID(); ?>" class="comment">
319-
<header>
320-
<?php
321-
echo "<span class='th alignleft' style='margin-right:1rem;'>";
322-
echo get_avatar( $comment, 44 );
323-
echo "</span>";
324-
printf( '%2$s %1$s',
325-
get_comment_author_link(),
326-
( $comment->user_id === $post->post_author ) ? '<span class="label">' . __( 'Post Author', 'foundation' ) . '</span>' : ''
327-
);
328-
printf( '<br><a href="%1$s"><time datetime="%2$s">%3$s</time></a>',
329-
esc_url( get_comment_link( $comment->comment_ID ) ),
330-
get_comment_time( 'c' ),
331-
sprintf( __( '%1$s at %2$s', 'foundation' ), get_comment_date(), get_comment_time() )
332-
);
333-
?>
334-
</header>
335-
336-
<?php if ( '0' == $comment->comment_approved ) : ?>
337-
<p><?php _e( 'Your comment is awaiting moderation.', 'foundation' ); ?></p>
338-
<?php endif; ?>
339-
340-
<section>
341-
<?php comment_text(); ?>
342-
</section><!-- .comment-content -->
343-
344-
<div class="reply">
345-
<?php comment_reply_link( array_merge( $args, array( 'reply_text' => __( 'Reply', 'foundation' ), 'after' => ' &darr; <br><br>', 'depth' => $depth, 'max_depth' => $args['max_depth'] ) ) ); ?>
346-
347-
</div>
348-
</article>
349-
<?php
350-
break;
351-
endswitch;
352-
}
353333
endif;
354334

355-
356-
remove_filter('get_the_excerpt', 'wp_trim_excerpt');
357-
add_filter('get_the_excerpt', 'improved_trim_excerpt');
358-
359335
/**
360336
* Comments Template
361337
*/
@@ -414,81 +390,15 @@ function foundation_comment( $comment, $args, $depth ) {
414390
}
415391
endif;
416392

417-
/**
418-
* Comment-Reply Script
419-
**/
420-
function foundation_comment_reply(){
421-
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
422-
wp_enqueue_script( 'comment-reply' );
423-
}
424-
}
425-
426-
add_action( 'wp_enqueue_scripts', 'foundation_comment_reply' );
427-
428393
/**
429394
* Retrieve Shortcodes
395+
* @see: http://fwp.drewsymo.com/shortcodes/
430396
*/
431397

432-
require( get_template_directory() . '/inc/shortcodes.php' );
398+
$foundation_shortcodes = trailingslashit( get_template_directory() ) . 'inc/shortcodes.php';
433399

434-
/**
435-
* Set the content width based on the theme's design and stylesheet.
436-
*/
437-
if ( ! isset( $content_width ) )
438-
$content_width = 640; /* pixels */
439-
/**
440-
* Additional Header options
441-
**/
442-
443-
// add custom header options hook
444-
add_action('custom_header_options', 'foundation_image_options');
445-
446-
/* Adds two new text fields, custom_option_one and custom_option_two to the Custom Header options screen */
447-
function foundation_image_options()
448-
{
449-
?>
450-
<table class="form-table">
451-
<tbody>
452-
<tr valign="top" class="hide-if-no-js">
453-
<th scope="row"><?php _e( 'Custom Option One:' ); ?></th>
454-
<td><input id="custom_option_one" name="custom_option_one" type="checkbox" value="1" />
455-
456-
<label for="custom_option_one"><?php _e( 'option 1' ); ?></label></td>
457-
458-
</tr>
459-
<tr valign="top" class="hide-if-no-js">
460-
<th scope="row"><?php _e( 'Custom Option Two:' ); ?></th>
461-
<td><input id="custom_option_two" name="custom_option_two" type="checkbox" value="1" />
462-
463-
<label for="custom_option_two"><?php _e( 'option 2' ); ?></label></td>
464-
465-
</tr>
466-
400+
if (file_exists($foundation_shortcodes)) {
401+
require( $foundation_shortcodes );
402+
}
467403

468-
469-
</tbody>
470-
</table>
471-
<?php
472-
} // end foundation_image_options
473-
474-
475-
add_action('admin_head', 'foundation_custom_options');
476-
function foundation_custom_options()
477-
{
478-
if ( isset( $_POST['custom_option_one'] ) && isset( $_POST['custom_option_two'] ) )
479-
{
480-
// validate the request itself by verifying the _wpnonce-custom-header-options nonce
481-
// (note: this nonce was present in the normal Custom Header form already, so we didn't have to add our own)
482-
check_admin_referer( 'custom-header-options', '_wpnonce-custom-header-options' );
483-
484-
// be sure the user has permission to save theme options (i.e., is an administrator)
485-
if ( current_user_can('manage_options') ) {
486-
487-
// NOTE: Add your own validation methods here
488-
set_theme_mod( 'custom_option_one', $_POST['custom_option_one'] );
489-
set_theme_mod( 'custom_option_two', $_POST['custom_option_two'] );
490-
}
491-
}
492-
return;
493-
}
494404
?>

0 commit comments

Comments
 (0)