Support » Fixing WordPress » Functions : Colon Error

  • Parse error: syntax error, unexpected ‘:’ in /wp-content/themes/test/functions.php

    The code it’s referring to is:

    <?php
    if($args['type'] == 'all' || get_comment_type() == 'comment') :
    comment_reply_link(array_merge($args, array(
    'reply_text' => __('Reply','clean'),
    'login_text' => __('Log in to reply.','clean'),
    'depth' => $depth,
    'before' => '<div class="comment-reply-link">',
    'after' => '</div>'
    )));
    endif;
    ?>

    For the life of me I cannot figure out what’s wrong with the syntax.

    Thanks, Bryan

Viewing 3 replies - 1 through 3 (of 3 total)
  • Well it could be that your version of php uses the old syntax which would replace the “:” with “;” and that might work. If that doesn’t do the trick just use the normal syntax of { and }

    <?php
    if($args['type'] == 'all' || get_comment_type() == 'comment') {
    comment_reply_link(array_merge($args, array(
    'reply_text' => __('Reply','clean'),
    'login_text' => __('Log in to reply.','clean'),
    'depth' => $depth,
    'before' => '<div class="comment-reply-link">',
    'after' => '</div>'
    )));
    }
    ?>

    Should have been used in this case anyway really.

    Using either simply changes the character which is throwing the error.

    Whether : ; { or anything else coming off of 'comment')

    Very bizarre.

    Thanks, Bryan

    I went ahead and started from scratch again, no errors now.

    Likely an encoding problem, but I have no idea and there’s really no rhyme or reason, who knows. Sometimes it’s just like that.

    Thanks, Bryan

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Functions : Colon Error’ is closed to new replies.