• Hey,

    I’ve been trying all day to get Infinite Scroll & Masonry 3 to work with a WP site I’m working on. I’m using CPT pagination chaining, for individual type archives, but also using the following in order to include all types on the home page;

    add_action( 'pre_get_posts', 'add_my_post_types_to_query' );
    
    function add_my_post_types_to_query( $query ) {
    	if ( is_home() && $query->is_main_query() )
    		$query->set( 'post_type', array( 'post', 'videos', 'podcast' ) );
    	return $query;
    }

    The script I’m having to use to get Masonry 3 to work is:

    jQuery(window).load(function(){
    	var container = document.querySelector('#archive-wrap');
    	var msnry = new Masonry( container, {
    		// options
    		columnWidth: 306,
    		itemSelector: '.post-item',
    		"gutter": 20,
    		animate: true
    	});
    });

    I’ve been trying for hours to get these to work together, however I’ve had no luck, and my knowledge of JS and PHP is not good enough, and I’ve searched the web and WP support for a solution, but all of the various callbacks that I’m finding are failing to function.

    I should note that I have no idea if the CPT chaining or the inclusion of all types in the home page having anything to do with this problem, I just thought I would mention them in the event they do.

    Could any please help with this?

    Thanks,
    Darren.

    http://wordpress.org/plugins/infinite-scroll/

  • The topic ‘Infinite scroll, masonary 3, and CPT’ is closed to new replies.