• 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 16 replies (of 16 total)
  • Sorry, I should have done that but in the meantime I fixed it. Leaving
    add_theme_support('infinite-scroll') without parameters seems to do the trick.

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