瀏覽代碼

Dara: Set a higher content width when any of the footer widget areas are active to account for galleries in the full-width footer. Remove defunct Jetpack filter function for tiled galleries. See #40

Caroline Moore 7 年之前
父節點
當前提交
9e6a7dffe3
共有 2 個文件被更改,包括 9 次插入11 次删除
  1. 8 1
      dara/functions.php
  2. 1 10
      dara/inc/jetpack.php

+ 8 - 1
dara/functions.php

@@ -108,12 +108,19 @@ function dara_content_width() {
 add_action( 'after_setup_theme', 'dara_content_width', 0 );
 
 /**
- * Set the content width for the full-width page template.
+ * Set larger content width in some situations.
  */
 function dara_adjust_content_width() {
+
+	/* Set the content width for the front-page or testimonials templates */
 	if ( is_post_type_archive( 'jetpack-testimonial' ) || ( is_front_page() ) ) {
 		$GLOBALS['content_width'] = 1180;
 	}
+
+	/* Allow for full-width gallery display in the footer */
+	if ( is_active_sidebar( 'sidebar-2' ) || is_active_sidebar( 'sidebar-3' ) || is_active_sidebar( 'sidebar-4' ) ) {
+		$GLOBALS['content_width'] = 1086;
+	}
 }
 add_action( 'template_redirect', 'dara_adjust_content_width' );
 

+ 1 - 10
dara/inc/jetpack.php

@@ -170,13 +170,4 @@ function dara_has_post_thumbnail( $post = null ) {
 	} else {
 		return has_post_thumbnail( $post );
 	}
-}
-
-/**
- * Filter content width for galleries in widgets
- * to accomodate full-width footer widget areas
- */
-function dara_custom_gallery_content_width() {
-    return 1086;
-}
-add_filter( 'gallery_widget_content_width', 'dara_custom_gallery_content_width' );
+}