Просмотр исходного кода

Altofocus: Fix Isotope image overlap and Read More button position

Danny Dudzic 5 лет назад
Родитель
Сommit
b9983eb821

+ 7 - 3
altofocus/assets/js/grid.js

@@ -93,7 +93,7 @@
 	/**
 	 * Triggers re-layout on Isotope wrapper after infinite scroll has loaded new posts
 	 */
-	function reLayoutIsotope() {
+	function reLayoutIsotope( loadedPosts ) {
 
 		// Set array for newly added post IDs
 		var newPostIds = [];
@@ -103,7 +103,7 @@
 		if ( typeof loadedPosts !== 'undefined' ) {
 
 			// Create post IDs from IS results and push into post ID array
-			$.each( loadedPosts, function( index, value ) {
+			$.each( JSON.parse(loadedPosts), function( index, value ) {
 
 				var $appendedPost = '#post-'+ value;
 
@@ -171,7 +171,11 @@
 			/**
 			 * Relayout Isotope on post-load (Infinite Scroll)
 			 */
-			$body.on( 'post-load', reLayoutIsotope );
+			$body.on( 'post-load', function() {
+				var loadedPosts = $('#infinite-ids').attr('data');
+				reLayoutIsotope( loadedPosts );
+				$('#infinite-ids').remove();
+			});
 
 			/**
 			 * Window calls

+ 0 - 4
altofocus/assets/stylesheets/shared/_infinitescroll.scss

@@ -24,10 +24,6 @@
 	z-index: 1;
 	float: left;
 	top: 100%;
-	
-	.infinity-success & {
-		top: auto !important;
-	}
 
 	span {
 

+ 2 - 2
altofocus/inc/extras.php

@@ -105,8 +105,8 @@ function altofocus_post_classes( $classes ) {
 		}
 
 		// Get featured content settings and options
-		$featured_options    = get_option( 'featured-content' );
-		$featured_tag_name   = $featured_options[ 'tag-name' ];
+		$featured_options  = get_option( 'featured-content' );
+		$featured_tag_name = isset( $featured_options['tag-name'] ) ? $featured_options['tag-name'] : '';
 
 		if ( ! empty( $featured_tag_name ) && has_tag( $featured_tag_name, $post->ID ) ) {
 

+ 1 - 4
altofocus/inc/jetpack.php

@@ -175,10 +175,7 @@ function altofocus_infinite_scroll_render() {
 			$loaded_post_IDs[] = get_the_ID();
 		}
 	} ?>
-	<script>
-		// Put returned posts' IDs in to an array
-		var loadedPosts = <?php echo json_encode( $loaded_post_IDs ); ?>;
-	</script>
+	<input type="hidden" data="<?php echo esc_attr( json_encode( $loaded_post_IDs ) ); ?>" id="infinite-ids" />
 <?php
 }
 

+ 2 - 4
altofocus/style.css

@@ -5,7 +5,7 @@ Theme URI: https://wordpress.com/themes/altofocus/
 Author: Automattic, Inc
 Author URI: http://automattic.com
 Description: AltoFocus is a theme for photographers, artists, and other creative types in search of a simple and easy way to display their work.
-Version: 1.0.0-wpcom
+Version: 1.0.9-wpcom
 License: GNU General Public License v2 or later
 License URI: http://www.gnu.org/licenses/gpl-2.0.html
 Text Domain: altofocus
@@ -3023,9 +3023,7 @@ body {
   float: left;
   top: 100%;
 }
-.infinity-success #infinite-handle {
-  top: auto !important;
-}
+
 #infinite-handle span {
   background: transparent;
   display: block;