0

I have been dealing with this issue all day long, and I have no idea how to remedy it. I have searched for the issue on SO and have found my problem has occured to other people here. I have tried to the best of my ability to follow the steps that people have suggested to them but it still seems that I am getting the following error on my page:

Parse error: syntax error, unexpected $end in /hermes/waloraweb015/b1446/as.allthingsnetwork/blog/wp-content/themes/atn/functions.php on line 56

Through researching, I understand that error means that there are brackets that haven't been closed or missing ';' in the file. I have tried to fix those issues to no avail, so I'm here to post my code and possibly get a response from someone who is kind enough to help out.

functions.php:

<?php
// Enable support for post-thumbnails

add_theme_support('post-thumbnails');

if ( function_exists('add_theme_support') ) {
    add_theme_support('post-thumbnails');
}

function wpbeginner_remove_comment_url($arg) {
    $arg['url'] = '';
    return $arg;
}
add_filter('comment_form_default_fields', 'wpbeginner_remove_comment_url');


function wpbeginner_comment_text_after($arg) {
    $arg['comment_notes_before'] = "Let us know if you like this track</a>!";
    return $arg;
}

add_filter('comment_form_defaults', 'wpbeginner_comment_text_after');

  function custom_comments($comment, $args, $depth) {

       $GLOBALS['comment'] = $comment; ?>

       <div class="alignleft">
       <?php echo get_avatar(get_the_author_ID()); ?>
       </div>

        <li <?php comment_class(); ?> id="li-comment-<?php comment_ID(); ?>">

            <div class="comment-intro">
                <h3><?php printf(__('%s'), get_comment_author_link()); ?></h3>
                <a class="comment-permalink" href="<?php echo htmlspecialchars ( get_comment_link( $comment->comment_ID ) ) ?>"><?php printf(__('%1$s'), get_comment_date()); ?>
            </a>
            <em> | </em>
            <a class="comment-permalink" href="<?php echo htmlspecialchars ( get_comment_link( $comment->comment_ID ) ) ?>">
                <?php comment_time(); ?> 
            </a>
            </div>

            <?php if ($comment->comment_approved == '0') : ?>
                <em><php _e('Your comment is awaiting moderation.') ?></em><br />
            <?php endif; ?>

            <div class="comment-text">
            <?php comment_text(); ?>
            </div><br />

            <div class="reply">
                <?php comment_reply_link(array_merge( $args, array('depth' => $depth, 'max_depth' => $args['max_depth']))); ?>
            </div>

}
?>

Thank you so much in advance to anyone that is willing to help me out, Anthony.

Anthony
  • 3
  • 1
  • 3

1 Answers1

3

At the end you have:

}
?>

Should be:

<?php
}
?>

Here

<php _e('Your comment is awaiting moderation.') ?> 

Should be:

<?php _e('Your comment is awaiting moderation.'); ?>

And finally here, note you have it like this twice:

<?php echo htmlspecialchars ( get_comment_link( $comment->comment_ID ) ) ?> 

Should be:

<?php echo htmlspecialchars ( get_comment_link( $comment->comment_ID ) ); ?>
Prix
  • 19,417
  • 15
  • 73
  • 132
  • It's worth noting the first bit (i.e. ``) is what's causing the error. The rest is just best practices. – Nick Q. Jul 30 '13 at 23:57
  • @NickQ. nope, in some cases if u don't properly close your echo's it will produce errors as well. [See here a very simple example](https://eval.in/39864) – Prix Jul 31 '13 at 00:16
  • You're right in the fact that if any line doesn't end, PHP will not know how to handle another statement/line. However in the scenario provided, `?>` effectively ends the line and as such isn't what's causing the error. _**YES**_, it absolutely makes sense to have the semicolons, in case you decide to add to the block of code, to say nothing of uniformity. But is it causing Anthony's problem? No. – Nick Q. Jul 31 '13 at 04:56
  • @NickQ. regardless not everyone knows that, and in tons of questions around here you will see people committing small syntax errors which is better to teach/show good practices then poor coding, be it the problem or not. These small things may not be the case now but could be the case in the future so I would rather answer in a way it may prevent that. I also don't see a point on this argumentation but go ahead and enjoy yourself. – Prix Jul 31 '13 at 05:05
  • I think it's **great** to mention the best practices and get users on them. None the less, it's not the error itself. All I wanted to do was make sure that a user with the same error knew what _needed_ to be fixed and what their issue was (as that's what they were looking for) – Nick Q. Jul 31 '13 at 05:08