Viewing 15 replies - 1 through 15 (of 17 total)
  • Plugin Author Jeremy Herve

    (@jeherve)

    Jetpack Mechanic πŸš€

    Could you point me to the page listing all your blog posts, as set under Settings > Reading in your dashboard?

    Thanks!

    Thread Starter excessive34

    (@excessive34)

    The Front Page is set to: “Home” and this contains the post loop.

    I dont have a “Post-Page” set as I’ve completely customized the theme.

    If you take another look, I’ve gotten masonry to work with what im doing.. However, Infinite-Scroll I am having no luck.

    Is this something I’m going to need to put in without jetpack since everything is customized?

    Plugin Author Jeremy Herve

    (@jeherve)

    Jetpack Mechanic πŸš€

    Ok, I see you have now switched to your custom theme. I can see the posts now.

    Infinite Scroll will only work on your Posts page and on archive pages (ref).

    If you want Infinite Scroll to be loaded on your static front page as well, you will have to add Infinite Scroll support to is_front_page().

    To do so, you can add the following code to your theme’s functions.php file:

    function tweakjp_custom_is_support() {
    	$supported = current_theme_supports( 'infinite-scroll' ) && ( is_home() || is_archive() || is_front_page() );
    
    	return $supported;
    }
    add_filter( 'infinite_scroll_archive_supported', 'tweakjp_custom_is_support' );

    Once you’ve done so, you can follow this tutorial to make sure Infinite Scroll works with JS Masonry:
    http://wptheming.com/2013/04/jetpack-infinite-scroll-masonry/

    Thread Starter excessive34

    (@excessive34)

    Awesome, I’ve added the above function.. However, still no luck.

    I’m curious as to if me not having pagination has anything to do with new elements not loading?

    Or.. Could it be my post loop?
    Or… Do I simply need to follow the link you’ve provided?

    Heres the top portion of my loop:

    global $more;
    $more = 0;
    query_posts('cat=7,8,9,10&posts_per_page=15' );
    if (have_posts()) : while (have_posts()) : the_post(); ?>

    In any case, I really appreciate the help my friend. I’ve been at this for a day or so to no avail and your help is truly appreciated.

    Plugin Author Jeremy Herve

    (@jeherve)

    Jetpack Mechanic πŸš€

    I’m curious as to if me not having pagination has anything to do with new elements not loading?

    This can be caused by different factors, like the number of posts, whether you added pagination links or not, or your jQuery Masonry settings.

    You should be able to get things working with the tutorial I mentioned in my last post.

    As a sidenote, I would recommend that you use WP_Query instead of query_posts to build your loop. You can read more about it here:
    http://developer.wordpress.com/2012/05/14/querying-posts-without-query_posts/

    Thread Starter excessive34

    (@excessive34)

    I’ve added the correct pagination, removed the post feature. Still with no luck.

    Where exactly do I place the code from the tutorial that you posted to get it worked with masonry? Does that go in functions.php?

    Thread Starter excessive34

    (@excessive34)

    Additionally, I removed the Masonry script to see if that was interfering, infinite scroll still did not load additional posts.

    Thread Starter excessive34

    (@excessive34)

    I may have located the issue: When turning on the debugger, heres what I was greeted with:

    `
    Notice: Undefined property: WP_Query::$post in /home4/aa/public_html/wordpress/wp-includes/query.php on line 3017

    Notice: Trying to get property of non-object in /home4/aa/public_html/wordpress/wp-includes/query.php on line 3385

    Notice: Trying to get property of non-object in /home4/aa/public_html/wordpress/wp-includes/query.php on line 3387

    Notice: Trying to get property of non-object in /home4/aa/public_html/wordpress/wp-includes/query.php on line 3389

    Plugin Author Jeremy Herve

    (@jeherve)

    Jetpack Mechanic πŸš€

    Notice: Undefined property: WP_Query::$post in /home4/aa/public_html/wordpress/wp-includes/query.php on line 3017

    You’ll probably need to edit your Post query to solve this issue. You can find a lot of examples on this Codex page:
    http://codex.ww.wp.xz.cn/Class_Reference/WP_Query

    Thread Starter excessive34

    (@excessive34)

    That seems to have led me on the right track, thanks my friend!

    Plugin Author Jeremy Herve

    (@jeherve)

    Jetpack Mechanic πŸš€

    I see you’ve tried to use Infinite Scroll with Masonry, but still experience issues.

    You used the code provided in the tutorial I linked to earlier, but I still see some Javascript errors when browsing your site. These errors seem to be created by Masonry:
    http://i.wpne.ws/QYDg

    You’ll want to make sure that jQuery Masonry is correctly called on your site.

    Thread Starter excessive34

    (@excessive34)

    Alright heres what I have.

    header.php (Placed above the body tag)

    <script>
    jQuery( document ).ready( function( $ ) {
         infinite_count = 0;
         // Triggers re-layout on infinite scroll
         $( document.body ).on( 'post-load', function () {
    	infinite_count = infinite_count + 1;
    	var $container = $('#content');
    	var $selector = $('#infinite-view-' + infinite_count);
    	var $elements = $selector.find('.hentry');
    	$elements.hide();
    	$container.masonry( 'reload' );
    	$elements.fadeIn();
         });
    });
    </script>

    functions.php

    function my_masonry() {
    	if (!is_admin()) {
    		wp_register_script('jquery_masonry', get_template_directory_uri(). '/js/jquery.masonry.min.js', array('jquery'), '2.0.110526' );
    		wp_enqueue_script('jquery_masonry');
    		add_action('wp_footer', 'add_my_masonry');
    
    		function add_my_masonry() { ?>
    			<script>
    				jQuery(document).ready(function($){
    					$('#content').masonry({
    						itemSelector: 'article',
    					});
    			  	});
    			</script>
    		<?php
    		}
    	}
    }
    
    add_action('init', 'my_masonry');

    Do you see any issues within either of these?
    Or am I calling the script in the header incorrectly?

    Plugin Author Jeremy Herve

    (@jeherve)

    Jetpack Mechanic πŸš€

    You seem to be using a different code on your site at the moment. I do not see any mention of the first code snippet, and the code you created via the add_my_masonry is different, and does seem to be loaded before wp_footer.

    Could you make sure the code you mentioned above is added properly?

    Thread Starter excessive34

    (@excessive34)

    Sorry, I was messing around and tried something different.

    Everything is back in place, again.. I really appreciate you helping me to resolve this.

    Plugin Author Jeremy Herve

    (@jeherve)

    Jetpack Mechanic πŸš€

    I don’t seem to be able to access your site at the moment. Could you let me know once it’s back up?

    You might also want to switch to the Twenty Twelve and add only the jQuery Masonry to that theme, since it already supports Infinite Scroll.

Viewing 15 replies - 1 through 15 (of 17 total)

The topic ‘Infinite Scroll help needed’ is closed to new replies.