Permalink
Browse files

added option to allow changing of media width on pages which sidebars…

… are disabled
  • Loading branch information...
1 parent 5cd6276 commit ef5ffa30e5f15c3b88808bbb036f320ac1352dcc @Frumph committed Dec 30, 2013
Showing with 26 additions and 14 deletions.
  1. +10 −11 functions.php
  2. +2 −1 options.php
  3. +12 −2 options/general.php
  4. +2 −0 page.php
View
@@ -222,21 +222,19 @@ function comicpress_is_bbpress() {
return false;
}
-if (!function_exists('comicpress_sidebars_disabled')) {
- function comicpress_sidebars_disabled() {
- global $post;
- if (!is_404() && is_page() && !empty($post)) {
- $sidebars_disabled = get_post_meta($post->ID, 'disable-sidebars', true);
- if ($sidebars_disabled) return true;
- }
-// if (comicpress_is_bbpress()) return true;
- return false;
+function comicpress_sidebars_disabled() {
+ global $wp_query, $post;
+ if (!empty($post) && (is_single() || is_page()) && !is_404()) {
+ $sidebars_disabled = get_post_meta($post->ID, 'disable-sidebars', true);
+ if ($sidebars_disabled) return true;
}
+// if (comicpress_is_bbpress()) return true;
+ return false;
}
global $content_width;
if (!isset($content_width)) {
- $content_width = comicpress_themeinfo('content_width');
+ $content_width = comicpress_themeinfo('content_width');
if (!$content_width) $content_width = 500;
}
@@ -371,7 +369,8 @@ function comicpress_load_options() {
'menubar_social_myspace' => '',
'menubar_social_email' => '',
'enable_jetpack_infinite_scrolling' => false,
- 'content_width' => 500
+ 'content_width' => 500,
+ 'content_width_disabled_sidebars' => 700
) as $field => $value) {
$comicpress_options[$field] = $value;
}
View
@@ -174,7 +174,8 @@ function comicpress_admin_options() { ?>
'custom_image_header_height',
'archive_display_order',
'excerpt_or_content_in_archive',
- 'content_width'
+ 'content_width',
+ 'content_width_disabled_sidebars'
) as $key) {
if (isset($_REQUEST[$key]))
$comicpress_options[$key] = wp_filter_nohtml_kses($_REQUEST[$key]);
View
@@ -58,12 +58,22 @@
</thead>
<tr>
<?php if (!isset($comicpress_options['content_width'])) $comicpress_options['content_width'] = 500; ?>
- <th scope="row"><label for="content_width"><?php _e('How wide do you want the media and images content to appear in posts and pages?','comicpress'); ?></label></th>
+ <th scope="row"><label for="content_width"><?php _e('Media and images width on posts and pages?','comicpress'); ?></label></th>
<td>
<input type="text" size="4" name="content_width" id="content_width" value="<?php echo $comicpress_options['content_width']; ?>" />px
</td>
<td>
- <?php _e('This sets a specific width for WordPress to use for media content within your posts. Default = 500','comicpress'); ?>
+ <?php _e('This sets a specific width for WordPress to use for media content within your posts and pages. Default = 500','comicpress'); ?>
+ </td>
+ </tr>
+ <tr class="alternate">
+ <?php if (!isset($comicpress_options['content_width_disabled_sidebars'])) $comicpress_options['content_width_disabled_sidebars'] = 700; ?>
+ <th scope="row"><label for="content_width_disabled_sidebars"><?php _e('Media and images width when sidebars are disabled on pages?','comicpress'); ?></label></th>
+ <td>
+ <input type="text" size="4" name="content_width_disabled_sidebars" id="content_width" value="<?php echo $comicpress_options['content_width_disabled_sidebars']; ?>" />px
+ </td>
+ <td>
+ <?php _e('When the sidebars are disabled on pages? Default = 700','comicpress'); ?>
</td>
</tr>
</table>
View
@@ -1,6 +1,8 @@
<?php
get_header();
+if (comicpress_sidebars_disabled()) $content_width = comicpress_themeinfo('content_width_disabled_sidebars');
+
while (have_posts()) : the_post();
get_template_part('content', 'page');
comments_template('', true);

0 comments on commit ef5ffa3

Please sign in to comment.