WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] functions error in admin (2 posts)

  1. oldbag66
    Member
    Posted 4 years ago #

    actually 2.8.5.

    Ok ive set up WP locally using MAMP, all works fine, uploaded to server, all works fine except when in admin in either PAGES / POSTS the comments column is throwing up the following error:

    Fatal error: Only variables can be passed by reference in /home/sites/samcartermusic.co.uk/public_html/wp-content/themes/sctemplate/functions.php on line 41

    The function file in my template says this:

    <?php
    add_filter('get_comments_number', 'comment_count', 0);
    function comment_count( $count ) {
    	global $id;
    	$comments_by_type = &separate_comments(get_comments('post_id=' . $id));
    	return count($comments_by_type['comment']);
    }
    ?>

    line 41 is this:
    $comments_by_type = &separate_comments(get_comments('post_id=' . $id));

    Its a bit beyond me this error, any help would be appreciated.

    thanks

  2. jbbrwcky
    Member
    Posted 4 years ago #

    Try this...

    $get_comments= get_comments('post_id=' . $id);
    $comments_by_type = &separate_comments($get_comments);

    ... instead of your line 41.

Topic Closed

This topic has been closed to new replies.

About this Topic