• Resolved multiformeingegno

    (@lorenzone92)


    Hi guys. I’d like to use the Infinite Scroll feature on a theme I created, but currently I’m having troubles with it.
    In particular, nothing shows up either with “click” or “scroll” type set. The URL of my website is “bombacarta DOT com”

    Here’s my index.php:

    <?php get_header(); ?>
    
    <?php if (is_home() && !is_paged()) { ?>
    
    	<!-- editoriale -->
    	<div id="editoriale">
    		<?php $my_query = new WP_Query('cat=10&showposts=1');
    		  while ($my_query->have_posts()) : $my_query->the_post();
    		  $do_not_duplicate = $post->ID; ?>
            <h2><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h2>
    		<div class="postinfo" style="margin-top:-10px">di <a href="<?php echo get_option('home'); ?>/author/<?php the_author_meta( user_nicename ); ?>/"><?php the_author(); ?></a> - pubblicato il <?php the_time('j F Y') ?> - <?php comments_popup_link('Nessun Commento ?', '1 Commento ?', '% Commenti ?'); ?><?php edit_post_link('modifica',' - [ ',' ]'); ?></div>
            <div id="editoriale-cont" class="entry"><?php the_content(' Leggi il resto ?'); ?></div>
    
    			<div class="postinfo" style="text-align:right;margin-top:10px">
    			<a href="<?php echo get_option('home'); ?>/blahblah">Blah blah ?</a>
    			</div>
    		<?php edit_post_link('Modifica', ' <div class="edit">', '</div>'); ?>
    		<?php endwhile; ?>
    	</div>
    	<!-- fine editoriale -->
    
    	<div class="hotnews" id="calendar">
    		<div style="padding:10px 0 15px 10px">
    		<?php $my_query = new WP_Query( 'page_id=18570' );
    		  while ($my_query->have_posts()) : $my_query->the_post();
    		  $do_not_duplicate2[] = $post->ID;?>
    
    					<h3><?php the_title(); ?></h3>
    					<div><?php the_content(); ?></div>
    					<?php edit_post_link('Modifica', ' <div class="edit">', '</div>'); ?>
    
    			<?php endwhile; ?>
    		</div>
    	</div>
    	<div style="margin-top:12px;padding-bottom:6px" id="cerca" class="hotnews">
          	<h3>Cerca nel sito</h3><p>
    		<form action="WEBSITE_URL" id="searchform" method="get">
    			<p><input type="text" style="width:135px;margin-right:10px" value="" name="s" id="s"><input type="submit" value="Vai" id="searchsubmit"></p>
    		</form>
    	</div>
    	<div class="fine-blocco"></div>
    
    <?php }	?>
    
    <?php get_sidebar(); ?>
    
    <!-- inizio contenuto -->
    	<div id="content">
    		<!-- post del blog -->
    		<?php
    		if (have_posts()) : while (have_posts()) : the_post();
    			if( $post->ID == $do_not_duplicate ) continue; ?>
    
    				<div class="post" id="post-<?php the_ID(); ?>">
    				    <h2><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h2>
    			        <div class="postinfo">di <a href="<?php echo get_option('home'); ?>/author/<?php the_author_meta( user_nicename ); ?>/"><?php the_author(); ?></a> - pubblicato il <?php the_time('j F Y') ?><?php edit_post_link('modifica',' - [ ',' ]'); ?> - <?php comments_popup_link('nessun commento ?', '1 commento ?', '% commenti ?'); ?></div>
    				    <div class="entry">
    				    	<?php the_content('[Continua ?]'); ?>
    				    </div>
    
    				</div><br style="clear:both">
    				<!-- fine post -->
    
    		<?php endwhile; ?>
    		<?php endif;?>
    
    	</div>
    <!-- fine contenuto -->
    
    <?php get_footer(); ?>

    As you can see I have loop set correctly!

    And this is what I added to functions.php:

    /**
     * Add theme support for infinite scroll
     *
     * @uses add_theme_support
     * @action after_setup_theme
     * @return null
     */
    function twenty_twelve_infinite_scroll_init() {
    	add_theme_support( 'infinite-scroll', array(
    		'container'      => 'content'
    	) );
    }
    add_action( 'after_setup_theme', 'twenty_twelve_infinite_scroll_init' );

    I tried also with the code for Twenty Ten/Eleven. Same result: posts don’t show up. Nothing happens.

    When I set type to either ‘click’ or ‘scroll’, with Firebug console I can track a call to this url: https://website.com/?infinity=scrolling&action=infinite_scroll&page=1&order=DESC, with the response: {“type”:”empty”} ! You can even check this with your browser replacing website.com with bombacarta DOT com. The response shouldn’t be empty! Why does this happen?

    Setup:
    PHP 5.4.8
    nginx 1.3.8

    https://www.ads-software.com/extend/plugins/jetpack/

    [ Please do not bump, that’s not permitted here. ]

Viewing 15 replies - 1 through 15 (of 16 total)
  • Plugin Contributor designsimply

    (@designsimply)

    Just for reference, is this where you’re getting the code examples from? https://jetpack.me/support/infinite-scroll/

    Thread Starter multiformeingegno

    (@lorenzone92)

    Yes

    Thread Starter multiformeingegno

    (@lorenzone92)

    I added this because I use a theme that doesn’t use content-(post-format).php:

    function twenty_ten_infinite_scroll_render() {
    	get_template_part( 'loop' );
    }

    But it’s the same… still getting a {“type”:”empty”} response when I reach the end of the page.

    Plugin Contributor designsimply

    (@designsimply)

    Just to make sure, can you go to the main Jetpack page for your site and make sure the “Infinite Scroll” module is activated?

    Thread Starter multiformeingegno

    (@lorenzone92)

    Yes, I’m sure it was activated when I tested this ??
    Now it’s off tough, I can reactivate it if you need some data

    Plugin Contributor designsimply

    (@designsimply)

    Okay, I was looking at it again, and I couldn’t test the URL you mentioned since you turned off the infinite scroll setting in Jetpack.

    Your loop for post content looks okay to me (but I am not an expert in that). I also tried copying the index.php and functions.php files you posted into a copy of the Twenty Twelve theme I made and infinite scroll worked in my test, but I’m not sure that test was good enough because it doesn’t use the same theme files you are using.

    Maybe we could start with something even more basic. If you temporarily switch to Twenty Twelve and turn on Infinite Scroll via the Jeptack page, does it work for you then?

    Plugin Contributor Erick Hitter

    (@ethitter)

    Does your theme’s header.php include a call to the wp_head() function? Jetpack uses that function to output the information needed for each Infinite Scroll request, and if that variable isn’t available, Infinite Scroll cannot function.

    If wp_head() isn’t present, you’ll need to add it just before the </head> tag in your theme.

    If wp_head() is present, can you:

    1. Temporarily enable Infinite Scroll
    2. Load your site’s homepage
    3. View the source for your site
    4. Provide the source via a service such as Pastebin
    5. Disable Infinite Scroll

    Thanks!

    This issue is happening for me as well. I get a response of {“type”: “empty”} from the infinite scroll. Here is the code that my site uses:

    function the_style_infinite_scroll_init() {
    	add_theme_support( 'infinite-scroll', array(
    		'container' => 'boxes',
    		'render'    => 'the_style_infinite_scroll_render',
    		'footer_widgets' => array ('Footer'),
    		'type' => 'scroll'
    	) );
    }
    add_action( 'init', 'the_style_infinite_scroll_init' );
    
    function the_style_infinite_scroll_render() {
    	get_template_part( 'entry' );
    }

    You can visit talkorm.com to see what I mean. Just scroll to the bottom of the page and check your requests in your browser’s debug.

    Thread Starter multiformeingegno

    (@lorenzone92)

    Hi Erick. I updated Jetpack to the latest version to see if this has been fixed but I’m still getting the same problem: {“type”:”empty”} reply to the request /?infinity=scrolling&action=infinite_scroll&page=1&order=DESC&scripts%5B%5D=jquery&scripts%5B%5D=the-neverending-homepage&scripts%5B%5D=swfobject&scripts%5B%5D=videopress&scripts%5B%5D=spin&scripts%5B%5D=jquery.spin&scripts%5B%5D=jquery-cycle&scripts%5B%5D=jetpack-slideshow&scripts%5B%5D=devicepx&styles%5B%5D=the-neverending-homepage&styles%5B%5D=jetpack-slideshow&styles%5B%5D=jetpack-widgets

    I’m leaving Infinite Scroll active on bombacarta.com for 1 day to let you do some test if you want.. Then I need to turn it back off.. ??

    Thread Starter multiformeingegno

    (@lorenzone92)

    Sorry, had to disable it..

    Plugin Contributor Richard Archambault

    (@richardmtl)

    Hi there,

    Infinite Scroll doesn’t currently support custom queries within templates. We may add support for it in the future but for now, only the main query is supported.

    I was getting the same {“type”:”empty”} response until I used the “render” option when enabling infinite-scroll support. I’m using a Genesis child theme, so I found that this post fixed my problem:

    https://www.limecanvas.com/integrating-jetpack-infinite-scroll-with-genesis/

    Thread Starter multiformeingegno

    (@lorenzone92)

    I’m using a theme I created, in which I have single.php with this content:

    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    		<div class="post" id="post-<?php the_ID(); ?>">
    		<h1><?php the_title(); ?></h1>
    		<div class="postinfo">di <?php the_author_posts_link(); ?> - pubblicato il <?php the_time('j F Y') ?> <span class="noprint"><?php edit_post_link('Modifica',' [ ',' ]'); ?></span></div>
    		<div class="entry">
    			<?php the_content() ?>
    		</div>
    		</div>

    How do I use ‘render’?

    I’m encountering the same problem, though I don’t know what could created it as it worked well until recently.
    Any tips to debug this?

    Thank you.
    PS. It’s a bit weird that it works ok on domain.com/page/2/

    Plugin Contributor Richard Archambault

    (@richardmtl)

    @akis:

    Could you please start a new thread as per the Forum Guidelines, and ideally, include a link to your site and as much information as possible? Thanks.

Viewing 15 replies - 1 through 15 (of 16 total)
  • The topic ‘Infinite Scroll – {"type":"empty"} as response to ?infinity=scrolling&action’ is closed to new replies.