Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm using a custom function to output comments. It seems to work fine, however I've added the following notice for when comments are yet to be approved:

<p class="awaiting-approval">New comment is awaiting approval</p>

However, rather than this just showing to the comment author, it seems to be showing to everyone. Is WP supposed to use cookies to determine who the author was?

Here is the full code for the function if that helps: http://pastebin.com/Wrs3LaZ7

    function theme_commentCustom( $comment, $args, $depth ) {
        $GLOBALS['comment'] = $comment;
        switch ( $comment->comment_type ) :
            case 'pingback' :
            case 'trackback' :
                <li class="post pingback">
                    <p><?php _e( 'Pingback:', 'customtheme' ); ?> <?php comment_author_link(); ?><?php edit_comment_link( __( 'Edit', 'customtheme' ), '<div class="edit">', '</div>' ); ?></p>

            default :
                <li id="li-comment-<?php comment_ID(); ?>" class="grid_6">
                        <?php if ( $comment->comment_approved == '0' ) : ?>
                            <p class="awaiting-approval">New comment is awaiting approval</p>
                        <?php else : ?>
                            <div class="content">
                                <p class="quote"><?php echo get_comment_text(); ?></p>
                                <p class="cite"><?php comment_author(); ?></p>
                        <?php endif; ?>

Also, I'm calling the function like so, in my WordPress comments file: http://pastebin.com/r4fweRQJ

    // determine id depending on whether sidebar or member comments page
    $id = 'feed-comments';
    if ($post->ID != 9) {
        $id .= '-sidebar';

<div id="<?php echo $id; ?>" class="feed-comments">
    <?php if ( post_password_required() ) : ?>
        <p class="nopassword"><?php _e( 'This post is password protected. Enter the password to view any comments.'); ?></p>
    </div><!-- #comments -->
        /* Stop the rest of comments.php from being processed,
        * but don't kill the script entirely -- we still have
        * to fully load the template.

        $comments = get_comments(array('post_id' => 9));
        // limit comments if comments displaying in sidebar

        if (is_page(9)) {
            $args = array('callback' => 'theme_commentCustom');
        } else {
            $args = array('callback' => 'theme_commentCustom', 'per_page' => 3);

    <ul class="feed">
            /* Loop through and list the comments. Tell wp_list_comments()
            * to use theme_commentCustom() to format the comments.
            * If you want to overload this in a child theme then you can
            * define theme_commentCustom() and that will be used instead.
            * See theme_commentCustom() in customtheme/functions.php for more.
            wp_list_comments( $args, $comments );

    <?php if (is_page(9)) : ?>
        <?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : // are there comments to navigate through ?>
            <nav id="comment-nav-below">
                <div class="nav-next"><?php next_comments_link( __( 'Older Comments &rarr;', 'customtheme' ) ); ?></div>
                <div class="nav-previous"><?php previous_comments_link( __( '&larr; Newer Comments', 'customtheme' ) ); ?></div>
        <?php endif; // check for comment navigation ?>
    <?php endif; ?>

</div><!-- #feed-comments -->
share|improve this question

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.