0

I would like to add jetpack infinity scroll to my webpage.
Unfortunately the div which contain all post, not have ID only class have him, so I added ID with php:

if ( is_home() ) {
$homepagepostsid="posts-content";
}else{
  $homepagepostsid="";
}

HTML:

<div id="<?php $homepagepostsid ?>" class="loop-container loop-container--wp <?php echo esc_attr($loop_classes); ?>">
</div>

As you can see, I tried to reach something like this in some world:
If you're on home page, php add a id to loop-container loop-container-- div, else the id value is empty.
Unfortunately in somehow this doesn't work, because the infinity scroll trying to load posts to wp-admin area, which loos like this:
.
: enter image description here

On the top this text can be found:
"The comments closed"
And the chrome inspector also it confirm that hypothesis , which I mention before.
.
: enter image description here.
:.
: The page trying to load the posts to wp admin area.
How can I fix this?

My jetpack infinity scroll code in functions.php:

function zilla_infinite_scroll_render() {  
}    
get_template_part( 'loop_item', 'standard' );  
  add_theme_support( 'infinite-scroll', array(  
    'container' => 'posts-content',  
    'render'    => 'zilla_infinite_scroll_render',  
    'type'           => 'scroll',
)); 
m4n0
  • 29,823
  • 27
  • 76
  • 89
InBug
  • 43
  • 1
  • 9

1 Answers1

0

Try adding !is_admin to your condition,

$homepagepostsid = is_home() && !is_admin() ? 'posts-content' : '' ;
silver
  • 4,433
  • 1
  • 18
  • 30
  • Dosen't work, it's still trying to load post to wp-admin. – InBug Sep 12 '15 at 16:38
  • add the condition ```is_home() && !is_admin()``` on your jetpack script before embedding it – silver Sep 12 '15 at 16:40
  • Now I dosen't see on home page and wp admin are LOL And the jetpack said me: "This theme dosesn't support the infinty scroll" – InBug Sep 12 '15 at 16:47