• 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 ends

    function 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!

Viewing 7 replies - 1 through 7 (of 7 total)
  • Moderator Samuel Wood (Otto)

    (@otto42)

    www.ads-software.com Admin

    Don’t add it to the bottom after the closing ?> tag. Add it before that closing tag.

    Moderator Samuel Wood (Otto)

    (@otto42)

    www.ads-software.com Admin

    And if you still get an error, delete the closing ?> tag. It’s not necessary.

    Thread Starter cbachiega

    (@cbachiega)

    I am not adding after the closing ?> :/ I will try to delete and see what happens, thanks.

    Thread Starter cbachiega

    (@cbachiega)

    Still not working

    Moderator Samuel Wood (Otto)

    (@otto42)

    www.ads-software.com Admin

    The message you’re getting:

    output started at /hermes/waloraweb075/b2415/moo.domain/wp-content/themes/domain/functions.php:61

    Says what the problem is. Line 61 of that file is creating output. This usually means that you have something outside of the <?php block in that file. Removing the ending ?> will fix that problem.

    There’s no other fix, really. That is the problem.

    Thread Starter cbachiega

    (@cbachiega)

    the problem actually was an space after the ?> let’s try the plugin now, thank you

    Thread Starter cbachiega

    (@cbachiega)

    the plugin int loading the posts. I will search a little more

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘How to add Infinite Scroll’ is closed to new replies.