appthemes_page_comments_form

This function executes in the comments-page.php file and loads the page comments respond form. This function can be overridden and replaced with your own comments form.

Usage

This hook provides no parameters. You use this hook by having your function echo output to the browser, or by having it perform background tasks. Your functions shouldn’t return, and shouldn’t take any parameters.

add_action( 'appthemes_page_comments_form', 'your_function' );

Example

<?php
// let's remove the default ClassiPress blog comments form
remove_action( 'appthemes_page_comments_form', 'cp_main_comment_form' );
 
// use this comments form instead for pages
function insert_your_own_comments_form() { 
?>
    <div id="respond">
 
        <h2 class="dotted"><?php comment_form_title( __('Leave a Reply','appthemes'), __('Leave a Reply to %s','appthemes') ); ?></h2>
 
        <div class="cancel-comment-reply">
            <small><?php cancel_comment_reply_link(); ?></small>
        </div>
 
        <?php if ( get_option('comment_registration') && !is_user_logged_in() ) : ?>
 
            <p><?php printf( __("You must be <a href='%s'>logged in</a> to post a comment.", 'appthemes'), get_option('siteurl').'/wp-login.php?redirect_to='.urlencode( get_permalink() ) ); ?></p>
 
        <?php else : ?>
 
            <form action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform" class="commentform">
 
                <fieldset class="form-comments">
 
                <?php if ( is_user_logged_in() ) : global $user_identity; ?>
 
                    <p><?php _e('Logged in as','appthemes'); ?> <a href="<?php echo get_option('siteurl'); ?>/wp-admin/profile.php"><?php echo $user_identity; ?></a>. <a href="<?php echo wp_logout_url(); ?>" title="<?php _e('Logout of this account','appthemes'); ?>"><?php _e('Logout','appthemes'); ?> &raquo;</a></p>
 
                <?php else : ?>
 
                    <?php 
                        $commenter = wp_get_current_commenter();
                        $req = get_option( 'require_name_email' ); 
                    ?>
 
                    <p class="comments">
                        <label for="author"><?php _e('Name','appthemes'); ?> <?php if ( $req ) _e('(required)','appthemes'); ?></label>
                        <input type="text" name="author" id="author" class="text required" value="<?php echo esc_attr( $commenter['comment_author'] ); ?>" size="22" tabindex="1" />
                    </p>
 
                    <div class="clr"></div>
 
                    <p class="comments">
                        <label for="email"><?php _e('Email (will not be visible)','appthemes'); ?> <?php if ( $req ) _e('(required)','appthemes'); ?></label>
                        <input type="text" name="email" id="email" class="text required email" value="<?php echo esc_attr(  $commenter['comment_author_email'] ); ?>" size="22" tabindex="2" />                                
                    </p>
 
                    <div class="clr"></div>
 
                   <p class="comments">
                        <label for="url"><?php _e('Website','appthemes'); ?></label>
                        <input type="text" name="url" id="url" class="text" value="<?php echo esc_attr( $commenter['comment_author_url'] ); ?>" size="22" tabindex="3" />
                    </p>
 
                   <div class="clr"></div>
 
                <?php endif; ?>
 
                <p class="comments-box">
                    <textarea name="comment" rows="" cols="" id="comment" class="required" tabindex="4"></textarea>
                </p>
 
                <div class="clr"></div>
 
                <p class="comments">
                    <input name="submit" type="submit" id="submit" tabindex="5" class="btn_orange" value="<?php _e('Leave a Reply','appthemes'); ?>" />
                    <input type="hidden" name="comment_post_ID" value="<?php echo $id; ?>" />
                </p>
 
                <?php comment_id_fields(); ?>
                <?php do_action( 'comment_form', $post->ID ); ?>
 
                 </fieldset>
 
            </form>
 
        <?php endif; // if logged in ?>
 
        <div class="clr"></div>
 
    </div> <!-- /respond -->
 
<?php
}
add_action( 'appthemes_page_comments_form', 'insert_your_own_comments_form' ); 
?>

Changelog

  • since 1.1

Source File

appthemes_page_comments_form() is located in comments-page.php.

Your rating: none
Rating: 0 - 0 votes

Popular Add-ons

Profiler for Vantage

Adds a one page author website to your Vantage theme.


(6)
$39

WP Email Styler

Add good looking html template to emails


(3)
$19

BetterMobile

Enhance the mobile experience of your ClassiPress website!


(3)
$10