0

I have the following error with Wordpress using Woo-Commerce and Storefront theme.

Error is - Parse error: syntax error, unexpected 'function' (T_FUNCTION), expecting identifier (T_STRING)

Can anyone help?

This is the standard code from the theme. No edits. It just started to not work.

Here is the function from line 31:

    <?php
if ( ! function_exists( 'storefront_display_comments' ) ) {

    function storefront_display_comments() {
        // If comments are open or we have at least one comment, load up the comment template.
        if ( comments_open() || '0' != get_comments_number() ) :
            comments_template();
        endif;
    }
}

if ( ! function_exists( 'storefront_comment' ) ) {

    function storefront_comment( $comment, $args, $depth ) {
        if ( 'div' == $args['style'] ) {
            $tag = 'div';
            $add_below = 'comment';
        } else {
            $tag = 'li';
            $add_below = 'div-comment';
        }
        ?>
        <<?php echo esc_attr( $tag ); ?> <?php comment_class( empty( $args['has_children'] ) ? '' : 'parent' ) ?> id="comment-<?php comment_ID() ?>">
        <div class="comment-body">
        <div class="comment-meta commentmetadata">
            <div class="comment-author vcard">
            <?php echo get_avatar( $comment, 128 ); ?>
            <?php printf( wp_kses_post( '<cite class="fn">%s</cite>', 'storefront' ), get_comment_author_link() ); ?>
            </div>
            <?php if ( '0' == $comment->comment_approved ) : ?>
                <em class="comment-awaiting-moderation"><?php esc_attr_e( 'Your comment is awaiting moderation.', 'storefront' ); ?></em>
                <br />
            <?php endif; ?>

            <a href="<?php echo esc_url( htmlspecialchars( get_comment_link( $comment->comment_ID ) ) ); ?>" class="comment-date">
                <?php echo '<time datetime="' . get_comment_date( 'c' ) . '">' . get_comment_date() . '</time>'; ?>
            </a>
        </div>
        <?php if ( 'div' != $args['style'] ) : ?>
        <div id="div-comment-<?php comment_ID() ?>" class="comment-content">
        <?php endif; ?>
        <div class="comment-text">
        <?php comment_text(); ?>
        </div>
        <div class="reply">
        <?php comment_reply_link( array_merge( $args, array( 'add_below' => $add_below, 'depth' => $depth, 'max_depth' => $args['max_depth'] ) ) ); ?>
        <?php edit_comment_link( __( 'Edit', 'storefront' ), '  ', '' ); ?>
        </div>
        </div>
        <?php if ( 'div' != $args['style'] ) : ?>
        </div>
        <?php endif; ?>
    <?php
    }
}
Allsops
  • 123
  • 1
  • 17
  • 3
    Please provide some more code from before and after what you've provided. You've probably missed a `}`. – Jonnix Aug 07 '17 at 10:30
  • Possible duplicate of [PHP Parse/Syntax Errors; and How to solve them?](https://stackoverflow.com/questions/18050071/php-parse-syntax-errors-and-how-to-solve-them) – Exprator Aug 07 '17 at 10:34
  • Don't see why this got down-voted when everything I provided was satisfactory. – Allsops May 10 '18 at 15:31

1 Answers1

0

Found out the answer myself. Went into the file and removed a hr tag which was out of place and it fixed the issue.

Allsops
  • 123
  • 1
  • 17