closes #104 - adding a theme option for root relative URLs (enabled by default)
This commit is contained in:
@@ -54,7 +54,8 @@ function roots_fix_duplicate_subfolder_urls($input) {
|
||||
return $output;
|
||||
}
|
||||
|
||||
if (!is_admin()) {
|
||||
$roots_options = roots_get_theme_options();
|
||||
if (!is_admin() && $roots_options['root_relative_urls']) {
|
||||
add_filter('bloginfo_url', 'roots_root_relative_url');
|
||||
add_filter('theme_root_uri', 'roots_root_relative_url');
|
||||
add_filter('stylesheet_directory_uri', 'roots_root_relative_url');
|
||||
|
||||
@@ -150,6 +150,7 @@ function roots_get_default_theme_options() {
|
||||
'main_class' => $default_framework_settings['classes']['main'],
|
||||
'sidebar_class' => $default_framework_settings['classes']['sidebar'],
|
||||
'google_analytics_id' => '',
|
||||
'root_relative_urls' => true,
|
||||
'clean_menu' => true,
|
||||
'fout_b_gone' => false
|
||||
);
|
||||
@@ -220,6 +221,17 @@ function roots_theme_options_render_page() {
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr valign="top"><th scope="row"><?php _e('Enable Root Relative URLs', 'roots'); ?></th>
|
||||
<td>
|
||||
<fieldset><legend class="screen-reader-text"><span><?php _e('Enable Root Relative URLs', 'roots'); ?></span></legend>
|
||||
<select name="roots_theme_options[root_relative_urls]" id="roots_theme_options[root_relative_urls]">
|
||||
<option value="yes" <?php selected($roots_options['root_relative_urls'], true); ?>><?php echo _e('Yes', 'roots'); ?></option>
|
||||
<option value="no" <?php selected($roots_options['root_relative_urls'], false); ?>><?php echo _e('No', 'roots'); ?></option>
|
||||
</select>
|
||||
</fieldset>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr valign="top"><th scope="row"><?php _e('Cleanup Menu Output', 'roots'); ?></th>
|
||||
<td>
|
||||
<fieldset><legend class="screen-reader-text"><span><?php _e('Cleanup Menu Output', 'roots'); ?></span></legend>
|
||||
@@ -270,6 +282,9 @@ function roots_theme_options_validate($input) {
|
||||
if (isset($input['google_analytics_id']))
|
||||
$output['google_analytics_id'] = $input['google_analytics_id'];
|
||||
|
||||
if (isset($input['root_relative_urls']))
|
||||
$output['root_relative_urls'] = ($input['root_relative_urls'] === 'yes') ? true : false;
|
||||
|
||||
if (isset($input['clean_menu']))
|
||||
$output['clean_menu'] = ($input['clean_menu'] === 'yes') ? true : false;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user