Code cleanup
This commit is contained in:
@@ -75,25 +75,33 @@ function roots_get_stylesheets() {
|
|||||||
|
|
||||||
$styles = '';
|
$styles = '';
|
||||||
|
|
||||||
if ($roots_css_framework === 'blueprint') {
|
switch ($roots_css_framework) {
|
||||||
$styles .= stylesheet_link_tag('/blueprint/screen.css');
|
case 'blueprint' :
|
||||||
} elseif ($roots_css_framework === '960gs_12' || $roots_css_framework === '960gs_16') {
|
$styles .= stylesheet_link_tag('/blueprint/screen.css');
|
||||||
$styles .= stylesheet_link_tag('/960/reset.css');
|
break;
|
||||||
$styles .= stylesheet_link_tag('/960/text.css', 1);
|
case '960gs_12' :
|
||||||
$styles .= stylesheet_link_tag('/960/960.css', 1);
|
case '960gs_16' :
|
||||||
} elseif ($roots_css_framework === '960gs_24') {
|
$styles .= stylesheet_link_tag('/960/reset.css');
|
||||||
$styles .= stylesheet_link_tag('/960/reset.css');
|
$styles .= stylesheet_link_tag('/960/text.css', 1);
|
||||||
$styles .= stylesheet_link_tag('/960/text.css', 1);
|
$styles .= stylesheet_link_tag('/960/960.css', 1);
|
||||||
$styles .= stylesheet_link_tag('/960/960_24_col.css', 1);
|
break;
|
||||||
} elseif ($roots_css_framework === '1140') {
|
case '960gs_24' :
|
||||||
$styles .= stylesheet_link_tag('/1140/1140.css');
|
$styles .= stylesheet_link_tag('/960/reset.css');
|
||||||
} elseif ($roots_css_framework === 'adapt') {
|
$styles .= stylesheet_link_tag('/960/text.css', 1);
|
||||||
$styles .= stylesheet_link_tag('/adapt/master.css');
|
$styles .= stylesheet_link_tag('/960/960_24_col.css', 1);
|
||||||
$styles .= "\t<noscript>\n";
|
break;
|
||||||
$styles .= stylesheet_link_tag('/adapt/mobile.css', 1);
|
case '1140' :
|
||||||
$styles .= "\t</noscript>\n";
|
$styles .= stylesheet_link_tag('/1140/1140.css');
|
||||||
} elseif ($roots_css_framework === 'less') {
|
break;
|
||||||
$styles .= stylesheet_link_tag('/less/less.css');
|
case 'adapt' :
|
||||||
|
$styles .= stylesheet_link_tag('/adapt/master.css');
|
||||||
|
$styles .= "\t<noscript>\n";
|
||||||
|
$styles .= stylesheet_link_tag('/adapt/mobile.css', 1);
|
||||||
|
$styles .= "\t</noscript>\n";
|
||||||
|
break;
|
||||||
|
case 'less' :
|
||||||
|
$styles .= stylesheet_link_tag('/less/less.css');
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (class_exists('RGForms')) {
|
if (class_exists('RGForms')) {
|
||||||
@@ -107,10 +115,13 @@ function roots_get_stylesheets() {
|
|||||||
$styles .= stylesheet_link_tag('/style.css', 1);
|
$styles .= stylesheet_link_tag('/style.css', 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($roots_css_framework === 'blueprint') {
|
switch ($roots_css_framework) {
|
||||||
$styles .= "\t<!--[if lt IE 8]>" . stylesheet_link_tag('/blueprint/ie.css', 0, false) . "<![endif]-->\n";
|
case 'blueprint' :
|
||||||
} elseif ($roots_css_framework === '1140') {
|
$styles .= "\t<!--[if lt IE 8]>" . stylesheet_link_tag('/blueprint/ie.css', 0, false) . "<![endif]-->\n";
|
||||||
$styles .= "\t<!--[if lt IE 8]>" . stylesheet_link_tag('/1140/ie.css', 0, false) . "<![endif]-->\n";
|
break;
|
||||||
|
case '1140' :
|
||||||
|
$styles .= "\t<!--[if lt IE 8]>" . stylesheet_link_tag('/1140/ie.css', 0, false) . "<![endif]-->\n";
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
echo $styles;
|
echo $styles;
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
// http://foolswisdom.com/wp-activate-theme-actio/
|
// http://foolswisdom.com/wp-activate-theme-actio/
|
||||||
|
|
||||||
global $pagenow;
|
global $pagenow;
|
||||||
if (is_admin() && 'themes.php' === $pagenow && isset( $_GET['activated'])) {
|
if (is_admin() && $pagenow === 'themes.php' && isset( $_GET['activated'])) {
|
||||||
|
|
||||||
// on theme activation make sure there's a Home page
|
// on theme activation make sure there's a Home page
|
||||||
// create it if there isn't and set the Home page menu order to -1
|
// create it if there isn't and set the Home page menu order to -1
|
||||||
@@ -21,11 +21,12 @@ if (is_admin() && 'themes.php' === $pagenow && isset( $_GET['activated'])) {
|
|||||||
foreach ($pages_to_create as $new_page_title) {
|
foreach ($pages_to_create as $new_page_title) {
|
||||||
|
|
||||||
// create post object
|
// create post object
|
||||||
$add_default_pages = array();
|
$add_default_pages = array(
|
||||||
$add_default_pages['post_title'] = $new_page_title;
|
'post_title' => $new_page_title,
|
||||||
$add_default_pages['post_content'] = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum consequat, orci ac laoreet cursus, dolor sem luctus lorem, eget consequat magna felis a magna. Aliquam scelerisque condimentum ante, eget facilisis tortor lobortis in. In interdum venenatis justo eget consequat. Morbi commodo rhoncus mi nec pharetra. Aliquam erat volutpat. Mauris non lorem eu dolor hendrerit dapibus. Mauris mollis nisl quis sapien posuere consectetur. Nullam in sapien at nisi ornare bibendum at ut lectus. Pellentesque ut magna mauris. Nam viverra suscipit ligula, sed accumsan enim placerat nec. Cras vitae metus vel dolor ultrices sagittis. Duis venenatis augue sed risus laoreet congue ac ac leo. Donec fermentum accumsan libero sit amet iaculis. Duis tristique dictum enim, ac fringilla risus bibendum in. Nunc ornare, quam sit amet ultricies gravida, tortor mi malesuada urna, quis commodo dui nibh in lacus. Nunc vel tortor mi. Pellentesque vel urna a arcu adipiscing imperdiet vitae sit amet neque. Integer eu lectus et nunc dictum sagittis. Curabitur commodo vulputate fringilla. Sed eleifend, arcu convallis adipiscing congue, dui turpis commodo magna, et vehicula sapien turpis sit amet nisi.';
|
'post_content' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum consequat, orci ac laoreet cursus, dolor sem luctus lorem, eget consequat magna felis a magna. Aliquam scelerisque condimentum ante, eget facilisis tortor lobortis in. In interdum venenatis justo eget consequat. Morbi commodo rhoncus mi nec pharetra. Aliquam erat volutpat. Mauris non lorem eu dolor hendrerit dapibus. Mauris mollis nisl quis sapien posuere consectetur. Nullam in sapien at nisi ornare bibendum at ut lectus. Pellentesque ut magna mauris. Nam viverra suscipit ligula, sed accumsan enim placerat nec. Cras vitae metus vel dolor ultrices sagittis. Duis venenatis augue sed risus laoreet congue ac ac leo. Donec fermentum accumsan libero sit amet iaculis. Duis tristique dictum enim, ac fringilla risus bibendum in. Nunc ornare, quam sit amet ultricies gravida, tortor mi malesuada urna, quis commodo dui nibh in lacus. Nunc vel tortor mi. Pellentesque vel urna a arcu adipiscing imperdiet vitae sit amet neque. Integer eu lectus et nunc dictum sagittis. Curabitur commodo vulputate fringilla. Sed eleifend, arcu convallis adipiscing congue, dui turpis commodo magna, et vehicula sapien turpis sit amet nisi.',
|
||||||
$add_default_pages['post_status'] = 'publish';
|
'post_status' => 'publish',
|
||||||
$add_default_pages['post_type'] = 'page';
|
'post_type' => 'page'
|
||||||
|
);
|
||||||
|
|
||||||
// insert the post into the database
|
// insert the post into the database
|
||||||
$result = wp_insert_post($add_default_pages);
|
$result = wp_insert_post($add_default_pages);
|
||||||
@@ -35,13 +36,14 @@ if (is_admin() && 'themes.php' === $pagenow && isset( $_GET['activated'])) {
|
|||||||
update_option('show_on_front', 'page');
|
update_option('show_on_front', 'page');
|
||||||
update_option('page_on_front', $home->ID);
|
update_option('page_on_front', $home->ID);
|
||||||
|
|
||||||
$home_menu_order = array();
|
$home_menu_order = array(
|
||||||
$home_menu_order['ID'] = $home->ID;
|
'ID' => $home->ID,
|
||||||
$home_menu_order['menu_order'] = -1;
|
'menu_order' => -1
|
||||||
|
);
|
||||||
wp_update_post($home_menu_order);
|
wp_update_post($home_menu_order);
|
||||||
|
|
||||||
// set the permalink structure
|
// set the permalink structure
|
||||||
if (get_option('permalink_structure') != '/%year%/%postname%/') {
|
if (get_option('permalink_structure') !== '/%year%/%postname%/') {
|
||||||
update_option('permalink_structure', '/%year%/%postname%/');
|
update_option('permalink_structure', '/%year%/%postname%/');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -67,7 +69,7 @@ if (is_admin() && 'themes.php' === $pagenow && isset( $_GET['activated'])) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($roots_nav_theme_mod) {
|
if ($roots_nav_theme_mod) {
|
||||||
set_theme_mod('nav_menu_locations', $roots_nav_theme_mod );
|
set_theme_mod('nav_menu_locations', $roots_nav_theme_mod);
|
||||||
}
|
}
|
||||||
|
|
||||||
$primary_nav = wp_get_nav_menu_object('Primary Navigation');
|
$primary_nav = wp_get_nav_menu_object('Primary Navigation');
|
||||||
|
|||||||
@@ -13,9 +13,9 @@ add_action('template_redirect', 'roots_nice_search_redirect');
|
|||||||
function roots_search_query($escaped = true) {
|
function roots_search_query($escaped = true) {
|
||||||
$query = apply_filters('roots_search_query', get_query_var('s'));
|
$query = apply_filters('roots_search_query', get_query_var('s'));
|
||||||
if ($escaped) {
|
if ($escaped) {
|
||||||
$query = esc_attr( $query );
|
$query = esc_attr($query);
|
||||||
}
|
}
|
||||||
return urldecode($query);
|
return urldecode($query);
|
||||||
}
|
}
|
||||||
|
|
||||||
add_filter('get_search_query', 'roots_search_query');
|
add_filter('get_search_query', 'roots_search_query');
|
||||||
@@ -98,16 +98,21 @@ add_filter('the_generator', 'roots_no_generator');
|
|||||||
|
|
||||||
// cleanup wp_head
|
// cleanup wp_head
|
||||||
function roots_noindex() {
|
function roots_noindex() {
|
||||||
if (get_option('blog_public') === '0')
|
if (get_option('blog_public') === '0') {
|
||||||
echo '<meta name="robots" content="noindex,nofollow">', "\n";
|
echo '<meta name="robots" content="noindex,nofollow">', "\n";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function roots_rel_canonical() {
|
function roots_rel_canonical() {
|
||||||
if (!is_singular())
|
if (!is_singular()) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
global $wp_the_query;
|
global $wp_the_query;
|
||||||
if (!$id = $wp_the_query->get_queried_object_id())
|
if (!$id = $wp_the_query->get_queried_object_id()) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$link = get_permalink($id);
|
$link = get_permalink($id);
|
||||||
echo "\t<link rel=\"canonical\" href=\"$link\">\n";
|
echo "\t<link rel=\"canonical\" href=\"$link\">\n";
|
||||||
}
|
}
|
||||||
@@ -151,12 +156,9 @@ function roots_head_cleanup() {
|
|||||||
|
|
||||||
// deregister l10n.js (new since WordPress 3.1)
|
// deregister l10n.js (new since WordPress 3.1)
|
||||||
// why you might want to keep it: http://wordpress.stackexchange.com/questions/5451/what-does-l10n-js-do-in-wordpress-3-1-and-how-do-i-remove-it/5484#5484
|
// why you might want to keep it: http://wordpress.stackexchange.com/questions/5451/what-does-l10n-js-do-in-wordpress-3-1-and-how-do-i-remove-it/5484#5484
|
||||||
if (!is_admin()) {
|
|
||||||
wp_deregister_script('l10n');
|
|
||||||
}
|
|
||||||
|
|
||||||
// don't load jQuery through WordPress since it's linked in header.php
|
// don't load jQuery through WordPress since it's linked in header.php
|
||||||
if (!is_admin()) {
|
if (!is_admin()) {
|
||||||
|
wp_deregister_script('l10n');
|
||||||
wp_deregister_script('jquery');
|
wp_deregister_script('jquery');
|
||||||
wp_register_script('jquery', '', '', '', true);
|
wp_register_script('jquery', '', '', '', true);
|
||||||
}
|
}
|
||||||
@@ -396,4 +398,4 @@ function roots_change_mce_options($options) {
|
|||||||
|
|
||||||
add_filter('tiny_mce_before_init', 'roots_change_mce_options');
|
add_filter('tiny_mce_before_init', 'roots_change_mce_options');
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -9,8 +9,6 @@ if (stristr($_SERVER['SERVER_SOFTWARE'], 'apache') !== false) {
|
|||||||
|
|
||||||
add_action('admin_init', 'roots_htaccess_writable');
|
add_action('admin_init', 'roots_htaccess_writable');
|
||||||
|
|
||||||
$theme_name = next(explode('/themes/', get_stylesheet_directory()));
|
|
||||||
|
|
||||||
// Rewrites DO NOT happen for child themes
|
// Rewrites DO NOT happen for child themes
|
||||||
// rewrite /wp-content/themes/roots/css/ to /css/
|
// rewrite /wp-content/themes/roots/css/ to /css/
|
||||||
// rewrite /wp-content/themes/roots/js/ to /js/
|
// rewrite /wp-content/themes/roots/js/ to /js/
|
||||||
@@ -82,4 +80,4 @@ if (stristr($_SERVER['SERVER_SOFTWARE'], 'apache') !== false) {
|
|||||||
add_action('mod_rewrite_rules', 'roots_add_h5bp_htaccess');
|
add_action('mod_rewrite_rules', 'roots_add_h5bp_htaccess');
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -9,16 +9,14 @@ class roots_vcard extends WP_Widget {
|
|||||||
|
|
||||||
function widget($args, $instance) {
|
function widget($args, $instance) {
|
||||||
extract($args);
|
extract($args);
|
||||||
$title = $instance['title'];
|
extract($instance);
|
||||||
$street_address = $instance['street_address'];
|
|
||||||
$locality = $instance['locality'];
|
echo $before_widget;
|
||||||
$region = $instance['region'];
|
if ($title) {
|
||||||
$postal_code = $instance['postal_code'];
|
echo $before_title, $title, $after_title;
|
||||||
$tel = $instance['tel'];
|
}
|
||||||
$email = $instance['email'];
|
?>
|
||||||
?>
|
|
||||||
<?php echo $before_widget; ?>
|
|
||||||
<?php if ($title) echo $before_title, $title, $after_title; ?>
|
|
||||||
<p class="vcard">
|
<p class="vcard">
|
||||||
<a class="fn org url" href="<?php echo home_url('/'); ?>"><?php bloginfo('name'); ?></a><br>
|
<a class="fn org url" href="<?php echo home_url('/'); ?>"><?php bloginfo('name'); ?></a><br>
|
||||||
<span class="adr">
|
<span class="adr">
|
||||||
@@ -31,9 +29,8 @@ class roots_vcard extends WP_Widget {
|
|||||||
<a class="email" href="mailto:<?php echo $email; ?>"><?php echo $email; ?></a>
|
<a class="email" href="mailto:<?php echo $email; ?>"><?php echo $email; ?></a>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<?php echo $after_widget; ?>
|
<?php echo $after_widget;
|
||||||
|
|
||||||
<?php
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function update($new_instance, $old_instance) {
|
function update($new_instance, $old_instance) {
|
||||||
@@ -41,41 +38,34 @@ class roots_vcard extends WP_Widget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function form($instance) {
|
function form($instance) {
|
||||||
if (isset($instance['title'])) { $title = esc_attr($instance['title']); } else { $title = ''; }
|
|
||||||
if (isset($instance['street_address'])) { $street_address = esc_attr($instance['street_address']); } else { $street_address = ''; }
|
|
||||||
if (isset($instance['locality'])) { $locality = esc_attr($instance['locality']); } else { $locality = ''; }
|
|
||||||
if (isset($instance['region'])) { $region = esc_attr($instance['region']); } else { $region = ''; }
|
|
||||||
if (isset($instance['postal_code'])) { $postal_code = esc_attr($instance['postal_code']); } else { $postal_code = ''; }
|
|
||||||
if (isset($instance['tel'])) { $tel = esc_attr($instance['tel']); } else { $tel = ''; }
|
|
||||||
if (isset($instance['email'])) { $email = esc_attr($instance['email']); } else { $email = ''; }
|
|
||||||
?>
|
?>
|
||||||
<p>
|
<p>
|
||||||
<label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title (optional):', 'roots'); ?></label>
|
<label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title (optional):', 'roots'); ?></label>
|
||||||
<input type="text" name="<?php echo $this->get_field_name('title'); ?>" value="<?php echo $title; ?>" class="widefat" id="<?php echo $this->get_field_id('title'); ?>" />
|
<input type="text" name="<?php echo $this->get_field_name('title'); ?>" value="<?php echo esc_attr($instance['title']); ?>" class="widefat" id="<?php echo $this->get_field_id('title'); ?>" />
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<label for="<?php echo $this->get_field_id('street_address'); ?>"><?php _e('Street Address:', 'roots'); ?></label>
|
<label for="<?php echo $this->get_field_id('street_address'); ?>"><?php _e('Street Address:', 'roots'); ?></label>
|
||||||
<input type="text" name="<?php echo $this->get_field_name('street_address'); ?>" value="<?php echo $street_address; ?>" class="widefat" id="<?php echo $this->get_field_id('street_address'); ?>" />
|
<input type="text" name="<?php echo $this->get_field_name('street_address'); ?>" value="<?php echo esc_attr($instance['street_address']); ?>" class="widefat" id="<?php echo $this->get_field_id('street_address'); ?>" />
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<label for="<?php echo $this->get_field_id('locality'); ?>"><?php _e('City/Locality:', 'roots'); ?></label>
|
<label for="<?php echo $this->get_field_id('locality'); ?>"><?php _e('City/Locality:', 'roots'); ?></label>
|
||||||
<input type="text" name="<?php echo $this->get_field_name('locality'); ?>" value="<?php echo $locality; ?>" class="widefat" id="<?php echo $this->get_field_id('locality'); ?>" />
|
<input type="text" name="<?php echo $this->get_field_name('locality'); ?>" value="<?php echo esc_attr($instance['locality']); ?>" class="widefat" id="<?php echo $this->get_field_id('locality'); ?>" />
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<label for="<?php echo $this->get_field_id('region'); ?>"><?php _e('State/Region:', 'roots'); ?></label>
|
<label for="<?php echo $this->get_field_id('region'); ?>"><?php _e('State/Region:', 'roots'); ?></label>
|
||||||
<input type="text" name="<?php echo $this->get_field_name('region'); ?>" value="<?php echo $region; ?>" class="widefat" id="<?php echo $this->get_field_id('region'); ?>" />
|
<input type="text" name="<?php echo $this->get_field_name('region'); ?>" value="<?php echo esc_attr($instance['region']); ?>" class="widefat" id="<?php echo $this->get_field_id('region'); ?>" />
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<label for="<?php echo $this->get_field_id('postal_code'); ?>"><?php _e('Zipcode/Postal Code:', 'roots'); ?></label>
|
<label for="<?php echo $this->get_field_id('postal_code'); ?>"><?php _e('Zipcode/Postal Code:', 'roots'); ?></label>
|
||||||
<input type="text" name="<?php echo $this->get_field_name('postal_code'); ?>" value="<?php echo $postal_code; ?>" class="widefat" id="<?php echo $this->get_field_id('postal_code'); ?>" />
|
<input type="text" name="<?php echo $this->get_field_name('postal_code'); ?>" value="<?php echo esc_attr($instance['postal_code']); ?>" class="widefat" id="<?php echo $this->get_field_id('postal_code'); ?>" />
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<label for="<?php echo $this->get_field_id('tel'); ?>"><?php _e('Telephone:', 'roots'); ?></label>
|
<label for="<?php echo $this->get_field_id('tel'); ?>"><?php _e('Telephone:', 'roots'); ?></label>
|
||||||
<input type="text" name="<?php echo $this->get_field_name('tel'); ?>" value="<?php echo $tel; ?>" class="widefat" id="<?php echo $this->get_field_id('tel'); ?>" />
|
<input type="text" name="<?php echo $this->get_field_name('tel'); ?>" value="<?php echo esc_attr($instance['tel']); ?>" class="widefat" id="<?php echo $this->get_field_id('tel'); ?>" />
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<label for="<?php echo $this->get_field_id('email'); ?>"><?php _e('Email:', 'roots'); ?></label>
|
<label for="<?php echo $this->get_field_id('email'); ?>"><?php _e('Email:', 'roots'); ?></label>
|
||||||
<input type="text" name="<?php echo $this->get_field_name('email'); ?>" value="<?php echo $email; ?>" class="widefat" id="<?php echo $this->get_field_id('email'); ?>" />
|
<input type="text" name="<?php echo $this->get_field_name('email'); ?>" value="<?php echo esc_attr($instance['email']); ?>" class="widefat" id="<?php echo $this->get_field_id('email'); ?>" />
|
||||||
</p>
|
</p>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user