WordPress.org

Ready to get started?Download WordPress

Forums

Functions : Colon Error (4 posts)

  1. Bryan Hadaway
    Member
    Posted 3 years ago #

    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

  2. Ganners
    Member
    Posted 3 years ago #

    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.

  3. Bryan Hadaway
    Member
    Posted 3 years ago #

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

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

    Very bizarre.

    Thanks, Bryan

  4. Bryan Hadaway
    Member
    Posted 3 years ago #

    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

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.