浏览代码

Altofocus: Make sure only first gallery with type slideshow is affected when creating a featured slideshow on single post page. Fixes #52

alaczek 7 年之前
父节点
当前提交
6fd2139e01
共有 1 个文件被更改,包括 10 次插入1 次删除
  1. 10 1
      altofocus/inc/extras.php

+ 10 - 1
altofocus/inc/extras.php

@@ -139,6 +139,12 @@ add_action( 'wp_head', 'altofocus_pingback_header' );
 function altofocus_slideshow_gallery_filter( $output, $attr ) {
 
 	global $post;
+	
+	static $count = 0;
+	
+	if ( $count > 0 ) {
+		return $output; // Ensure the gallery output is replaced once.
+	}
 
 	static $instance = 0;
 	$instance++;
@@ -222,5 +228,8 @@ function altofocus_slideshow_gallery_filter( $output, $attr ) {
 	}
 
 	$output .= '</section>';
+	
+	$count++; // Update counter after successful replacement.
+	
 	return $output;
-}
+}