How to add Infinite Scroll
-
Hello, I am not able to install infinite scroll… And also every time I try to add something in my functions.php I got an error.
this my function.php
<?php
function getImage($num) {
global $more;
$more = 1;
$content = get_the_content();
$count = substr_count($content, ‘<img’);
$start = 0;
for($i=1;$i<=$count;$i++) {
$imgBeg = strpos($content, ‘<img’, $start);
$post = substr($content, $imgBeg);
$imgEnd = strpos($post, ‘>’);
$postOutput = substr($post, 0, $imgEnd+1);
$image[$i] = $postOutput;
$start=$imgEnd+1;$cleanF = strpos($image[$num],’src=”‘)+5;
$cleanB = strpos($image[$num],'”‘,$cleanF)-$cleanF;
$imgThumb = substr($image[$num],$cleanF,$cleanB);}
if(stristr($image[$num],'<img’)) { echo $imgThumb; }
$more = 0;
}
//retreive image endsfunction catch_that_image() {
global $post, $posts;
$first_img = ”;
ob_start();
ob_end_clean();
$output = preg_match_all(‘/<img.+src=[\'”]([^\'”]+)[\'”].*>/i’, $post->post_content, $matches);
$first_img = $matches [1] [0];if(empty($first_img)){ //Defines a default image
$first_img = “/images/default.jpg”;
}
return $first_img;
}if ( function_exists(‘register_sidebar’) )
register_sidebar(array(
‘before_widget’ => ‘<div class=”sidebar”>’,
‘after_widget’ => ‘<div style=”clear:both”></div></div>’,
‘before_title’ => ‘<div class=”text”>’,
‘after_title’ => ‘</div><div class=”clear”></div>’,
));// Thumbnail
if (function_exists( ‘add_theme_support’ ) ) :
add_theme_support( ‘post-thumbnails’ );
endif;
?>Then when I add the code
add_theme_support( ‘infinite-scroll’, array(
‘container’ => ‘content’,
‘footer’ => ‘page’,
) );I get this error…
Warning: Cannot modify header information – headers already sent by (output started at /hermes/waloraweb075/b2415/moo.domain/wp-content/themes/domain/functions.php:61) in /hermes/waloraweb075/b2415/moo.cahbachiegacom/wp-includes/pluggable.php on line 896
Thank you!
- The topic ‘How to add Infinite Scroll’ is closed to new replies.