treehouse : what would you like to learn today?
Web Design Web Development iOS Development

comments.php @wordpress (( syntax error ))

  • i had an error while comment.php loading .
    the error is :

    Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ')' in C:\xampp\htdocs\word\wp-content\themes\3thoob\comments.php on line 57




    <?php
    /**
    * @package WordPress
    *
    */
    ?>

    <div id="commentreplycontainer">
    <?php if ( post_password_required() ) : ?>
    <div class="must-log-in"><?php _e( 'هذه التدوينة محمية ، أدخل كلمة المرور لمشاهدة هذه التدوينة' ); ?></div>
    </div><!--END commentreplycontainer -->
    <?php
    /* Stop the rest of comments.php from being processed,
    * but don't kill the script entirely -- we still have
    * to fully load the template.
    */
    return;
    endif;
    ?>

    <?php
    // You can start editing here -- including this comment!
    ?>
    <?php if ( have_comments() ) : ?>
    <div id="commentscontainertitle">
    <h2>التعليقات على هذه التدوينة : <?php comments_number( '0', '1', '%' ); ?></h2>
    </div>

    <ul class="replycomment">
    <?php wp_list_comments( array( 'callback' => 'athoob_comment' ) ); ?>
    </ul>


    <?php else : // this is displayed if there are no comments so far ?>

    <?php if ( comments_open() ) : // If comments are open, but there are no comments ?>

    <?php else : // or, if we don't have comments:

    /* If there are no comments and comments are closed,
    * let's leave a little note, shall we?
    * But only on posts! We don't want the note on pages.
    */
    if ( ! comments_open() && ! is_page() ) :
    ?>
    <p class="must-log-in"><?php _e( 'التعليقات مغلقة' ); ?></p>
    <?php endif; // end ! comments_open() && ! is_page() ?>
    <?php endif; ?>

    <?php endif; ?>
    <?php comment_form(
    array(
    'fields' => apply_filters( 'comment_form_default_fields',
    array(
    'author' => '<div class="namespace">'.
    '<input id="" name="namespace" type="text" value="' .
    esc_attr( $commenter['comment_author'] ) '" />' .
    '<div class="alertcomment">حقل ضروري</div>'.
    '</div>',
    'email' => '<div class="email">'.
    '<input id="email" name="email" type="text" value="' . esc_attr( $commenter['comment_author_email'] ) . '" />' .
    '<div class="alertcomment">حقل ضروري</div>'.
    '</div>',
    'url' => '<div class="commentorwebsite">' .
    '<input id="url" name="commentorwebsite" type="text" value="' . esc_attr( $commenter['comment_author_url'] ) . '" />' .
    '</div>',
    'comment_field' => '<div class="commentarea">'.
    '<textarea name="commentarea" id="commentarea"></textarea> ' .
    '</div>'),

    'must_log_in' => '<div class="must-log-in">' . sprintf( __( 'You must be <a href="%s">logged in</a> to post a comment.' ), wp_login_url( apply_filters( 'the_permalink', get_permalink( $post_id ) ) ) ) . '</div>',
    'logged_in_as' => '<div class="logged-in-as">' . sprintf( __( 'Logged in as <a href="%s">%s</a>. <a href="%s" title="Log out of this account">Log out?</a></div>' ), admin_url( 'profile.php' ), $user_identity, wp_logout_url( apply_filters( 'the_permalink', get_permalink( $post_id ) ) ) ),
    'comment_notes_before' => '<div id="commentparttitle">
    <h2>اكتب تعليقك</h2>
    </div><!--END commentparttitle-->',
    'comment_notes_after' => ' ',
    'id_form' => 'commentform',
    'id_submit' => 'submit',
    'title_reply' => 'الرد على التعليق',
    'title_reply_to' => 'رد على هذا التعليق',
    'cancel_reply_link' => 'إلغاء الرد',
    'label_submit' => 'إضافة التعليق',
    ); ?>

    </div><!--END commentreplycontainer->





    what is the wrong ....!!!???
  • Remove all of this:
    <?php comment_form(
    array(
    'fields' => apply_filters( 'comment_form_default_fields',
    array(
    'author' => '<div class="namespace">'.
    '<input id="" name="namespace" type="text" value="' .
    esc_attr( $commenter['comment_author'] ) '" />' .
    '<div class="alertcomment">حقل ضروري</div>'.
    '</div>',
    'email' => '<div class="email">'.
    '<input id="email" name="email" type="text" value="' . esc_attr( $commenter['comment_author_email'] ) . '" />' .
    '<div class="alertcomment">حقل ضروري</div>'.
    '</div>',
    'url' => '<div class="commentorwebsite">' .
    '<input id="url" name="commentorwebsite" type="text" value="' . esc_attr( $commenter['comment_author_url'] ) . '" />' .
    '</div>',
    'comment_field' => '<div class="commentarea">'.
    '<textarea name="commentarea" id="commentarea"></textarea> ' .
    '</div>'),

    'must_log_in' => '<div class="must-log-in">' . sprintf( __( 'You must be <a href="%s">logged in</a> to post a comment.' ), wp_login_url( apply_filters( 'the_permalink', get_permalink( $post_id ) ) ) ) . '</div>',
    'logged_in_as' => '<div class="logged-in-as">' . sprintf( __( 'Logged in as <a href="%s">%s</a>. <a href="%s" title="Log out of this account">Log out?</a></div>' ), admin_url( 'profile.php' ), $user_identity, wp_logout_url( apply_filters( 'the_permalink', get_permalink( $post_id ) ) ) ),
    'comment_notes_before' => '<div id="commentparttitle">
    <h2>اكتب تعليقك</h2>
    </div><!--END commentparttitle-->',
    'comment_notes_after' => ' ',
    'id_form' => 'commentform',
    'id_submit' => 'submit',
    'title_reply' => 'الرد على التعليق',
    'title_reply_to' => 'رد على هذا التعليق',
    'cancel_reply_link' => 'إلغاء الرد',
    'label_submit' => 'إضافة التعليق',
    ); ?>

    Then add:
    <?php comment_form(); ?>

    And then go one by one through your arrays until you find the problem.
  • this reload the default form ...

    also im tired with this mess ..
  • It's not the default form because you have added a bunch of stuff. The WordPress built-in themes (twentyeleven) simply use the comment_form() function.
  • ok i solve the comments.php error ...

    but still there are problems ...
    look at this image : Your text to link...

    when i am not log in , there is a duplicate form , one from mine and other the default wordpress form .

    this is my single.php :

    <?php get_header();?>
    <div id="featuredslider"><!--this div contain any things about featured slider-->
    </div><!--END featuredslider-->




    <div id="container"><!-- this div includes ( posts main area + sidebar )-->

    <div id="posts"><!--this div include posts & its own-->

    <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?> <!--START the loop-->
    <div class="post"><!-- this div contain all single post and its info-->
    <div class="posttitle"><!-- this div contain the title of post-->
    <a href="<?php the_permalink(); ?>"><?php the_title('<h2>', '</h2>'); ?></a>
    </div><!-- END posttitle-->

    <div class="postmetadata">
    الكاتب : <a href="#"><?php the_author_link(); ?></a>
    <span class="spanDash">|</span>التصنيف : <?php the_category(', '); ?>
    <span class="spanDash">|</span>التاريخ : <a href="#"><?php the_time('j F Y'); ?></a>

    <div class="commentsnumber"><!-- this div contain the comments number which will take u to the comments of the specific post-->
    <span class="spanDash">|</span>التعليقات : <a href="<?php comments_link(); ?>"><?php comments_number( '0', '1', '%' ); ?> </a>
    </div><!-- END commentnumber-->

    </div><!--END postmetadata-->

    <div class="postimage"><!-- this div contain picture post-->
    <img src="<?php bloginfo('template_directory'); ?>/images/postlongimage.png" alt="صورة التدوينة"/>
    </div><!--END postimagelong-->


    <div class="postcontent"><!-- this div contain the content of the post-->

    <?php the_content( '<div class="more-link">أكمل القراءة</div>' ); ?> <!-- the content + READ MORE styling-->

    </div><!--END postcontent-->

    <div class="postdivider">
    <img src="<?php bloginfo('template_directory'); ?>/images/postdivider.png" alt="فاصل التدوينة"/>
    </div><!--END postdivider-->

    </div><!--END post class-->

    <?php comments_template( '', true ); ?>


    <?php endwhile; ?>
    <?php else : ?>
    <p>عفوا ، يبدو أنه لا يوجد أي تدوينات </p>
    <?php endif; ?> <!--END the loop-->



    </div><!--END posts-->
    <?php get_sidebar();?>
    <div id="pagination"><!--this div include any things related to PAGINATION pages-->
    </div><!--END pagnation-->
    <?php get_footer(); ?>






  • You are calling in this:
    <?php comments_template( '', true ); ?>

    Would need to see what's in there.
  • i will try to customize the default form .. but what is the the actually code of the default form ...??