WordPress.org

Ready to get started?Download WordPress

Forums

Getting a blank page when I style the comments in functions.php (7 posts)

  1. Tanya
    Member
    Posted 4 years ago #

    Hi everyone,

    I'm absolutely stumped as to what is wrong and have tried all the fixes I can find on the web.

    I want to edit my comments section, and I've managed to do that by adding some code to the functions.php file I found on another site.

    However when the comment is submitted it just goes to a blank page. The link for the blank page is http://peterahrens.com.au/wp-comments-post.php.

    When this code is in the functions.php file, every time I activate or deactivate a plugin it also goes to a blank page.

    Taking the code away makes everything run fine.

    The code in my functions php file is

    <?php //this function will be called in the next section
    function advanced_comment($comment, $args, $depth) {
       $GLOBALS['comment'] = $comment; ?>
    
    <li <?php comment_class(); ?> id="li-comment-<?php comment_ID() ?>">
       <div class="comment-author vcard">
         <?php echo get_avatar($comment,$size='48',$default='<path_to_url>' ); ?>
           <div class="comment-meta"<a href="<?php the_author_meta( 'user_url'); ?>"><?php printf(__('%s'), get_comment_author_link()) ?></a></div>
           <small><?php printf(__('%1$s at %2$s'), get_comment_date(),  get_comment_time()) ?><?php edit_comment_link(__('(Edit)'),'  ','') ?></small>
         </div>
         <div class="clear"></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>
    
       <div class="reply">
          <?php comment_reply_link(array_merge( $args, array('depth' => $depth, 'max_depth' => $args['max_depth']))) ?>
       </div>
       <div class="clear"></div>
    <?php } ?>

    I've tried using the default comments.php file and it acts the same. I've tried deactivating all plugins and that doesn't help.

    My website is at http://www.peterahrens.com.au. I would really really appreciate any help.

    Thanks,
    Peter

  2. Rev. Voodoo
    Volunteer Moderator
    Posted 4 years ago #

    heh, I used that exact tutorial, and it worked perfectly for me.

    Did you follow all the instructions perfectly? What is in your functions.php already? You don't have any blank lines before or after any of the opening or closing <?php ?> do you? I had a blank line between my blocks of php and it crashed my site.

  3. weirdnews
    Member
    Posted 4 years ago #

    open functions.php and config.php and remove any blank spaces below the last ?> the close ?> should be the absolute bottom.

  4. Tanya
    Member
    Posted 4 years ago #

    The only other code in my functions.php is this:

    <?php
    if ( function_exists('register_sidebars') )
    register_sidebars(2);
    ?>

    I followed this tutorial after trying it from another. It didn't work after either of them. Everything works fine but the last bit, it just lands on a blank white page.

    I've looked for any blank spaces multiple times and haven't found any. I'd even tried removing the extra space at the bottom.

    I've just tried changing themes and messing around and it does the same thing.

  5. Tanya
    Member
    Posted 4 years ago #

    If i try deactivating every single plugin and adding a comment it goes to a page with this

    Warning: Cannot modify header information - headers already sent by (output started at /home/pet34184/public_html/wp-content/themes/peterahrens/functions.php:6) in /home/pet34184/public_html/wp-includes/pluggable.php on line 868

  6. Tanya
    Member
    Posted 4 years ago #

    Hahaha, I just fixed it. I had a stupid space between the two functions. Thanks for your help. I think my fiancé is scared after my crazy laughing.

  7. Rev. Voodoo
    Volunteer Moderator
    Posted 4 years ago #

    that's telling me you have blank space in functions.php or something...

    <?php
    if ( function_exists('register_sidebars') )
    register_sidebars(2);
    ?>
    <?php //this function will be called in the next section
    function advanced_comment($comment, $args, $depth) {
       $GLOBALS['comment'] = $comment; ?>
    
    <li <?php comment_class(); ?> id="li-comment-<?php comment_ID() ?>">
       <div class="comment-author vcard">
         <?php echo get_avatar($comment,$size='48',$default='<path_to_url>' ); ?>
           <div class="comment-meta"<a href="<?php the_author_meta( 'user_url'); ?>"><?php printf(__('%s'), get_comment_author_link()) ?></a></div>
           <small><?php printf(__('%1$s at %2$s'), get_comment_date(),  get_comment_time()) ?><?php edit_comment_link(__('(Edit)'),'  ','') ?></small>
         </div>
         <div class="clear"></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>
    
       <div class="reply">
          <?php comment_reply_link(array_merge( $args, array('depth' => $depth, 'max_depth' => $args['max_depth']))) ?>
       </div>
       <div class="clear"></div>
    <?php } ?>

    with no blank lines at all at the top or bottom really should work....

    (EDIT, yup, that's the blank lines I was talking about...exactly the same problem I had)

Topic Closed

This topic has been closed to new replies.

About this Topic