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'); ?> »</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
Source File
appthemes_page_comments_form()
is located in comments-page.php
.
This function executes in the comments.php file and loads the blog 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_blog_comments_form', 'your_function' ); |
Example
<?php
// let's remove default ClassiPress blog comments form
remove_action( 'appthemes_blog_comments_form', 'cp_main_comment_form' );
// use this comments form instead for blog posts
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'); ?> »</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_blog_comments_form', 'insert_your_own_comments_form' );
?> |
Changelog
Source File
appthemes_blog_comments_form()
is located in comments.php
.
This function executes in the comments-page.php file and loads after the page comments respond 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_after_page_comments_form', 'your_function' ); |
Example: Legal Disclaimers
You can use this hook to add things like legal disclaimers or other information your readers should know after commenting.
<?php
function insert_comments_disclaimer() {
echo '<div class="disclaimer">' . __( 'Comments will be moderated and approved upon author\'s discretion.', 'appthemes' ) . '</div>';
}
add_action( 'appthemes_after_page_comments_form', 'insert_comments_disclaimer' );
?> |
Changelog
Source File
appthemes_after_page_comments_form()
is located in comments-page.php
.
This function executes in the comments.php file and loads after the blog comments respond form.
appthemes_after_blog_comments_form(); |
Example: Legal Disclaimers
You can use this hook to add things like legal disclaimers or other information your readers should know after commenting.
<?php
function insert_comments_disclaimer() {
echo '<div class="disclaimer">' . __( 'Comments will be moderated and approved upon author\'s discretion.', 'appthemes' ) . '</div>';
}
add_action( 'appthemes_after_blog_comments_form', 'insert_comments_disclaimer' );
?> |
Changelog
Source File
appthemes_after_blog_comments_form()
is located in comments.php
.
Runs in the loop.php file and runs before the have_posts() loop whenever any blog post is loaded.
appthemes_before_blog_loop(); |
Example: Advertisment
This code would display an AppThemes banner advertisement above the content of every page.
function insert_banner_ad_before_page_loop() {
echo '<a href="http://www.appthemes.com"><img src="http://www.appthemes.com/ads/at-468x60a.gif"></a>';
}
add_action( 'appthemes_before_blog_loop', 'insert_banner_ad_before_page_loop' ); |
Example: Advertisment on category page
This code would display an AppThemes banner advertisement above the content of category page.
function insert_banner_ad_on_category_page() {
if(is_category())
echo '<a href="http://www.appthemes.com"><img src="http://www.appthemes.com/ads/at-468x60a.gif"></a>';
}
add_action( 'appthemes_before_blog_loop', 'insert_banner_ad_on_category_page' ); |
Example: Adding an Announcement Bar
You can insert special information for the user about a sale, upcoming event, or other notification here.
function sale_annoucement() {
echo '<div class="annoucement">' . __( 'Come back July 5th for 10% off everything!', 'appthemes' ) . '</div>';
}
add_action( 'appthemes_before_blog_loop', 'sale_annoucement' ); |
Changelog
Source File
appthemes_before_blog_loop()
is located in loop.php
.
Executes in the loop.php file and runs after have_posts() within the loop whenever any blog post is loaded.
appthemes_before_blog_post(); |
Example: Advertisment
This code would display an AppThemes banner advertisement above the content of every page.
<?php
function insert_banner_ad_before_post() {
echo '<a href="http://www.appthemes.com"><img src="http://www.appthemes.com/ads/at-468x60a.gif"></a>';
}
add_action( 'appthemes_before_blog_post', 'insert_banner_ad_before_post' );
?> |
Example: Adding an Announcement Bar
You can insert special information for the user about a sale, upcoming event, or other notification here.
<?php
function sale_annoucement() {
echo '<div class="annoucement">' . __( 'Come back July 5th for 10% off everything!', 'appthemes' ) . '</div>';
}
add_action( 'appthemes_before_blog_post', 'sale_annoucement' );
?> |
Changelog
Source File
appthemes_before_blog_post()
is located in loop.php
.
Runs in the loop.php and loads before the blog post title.
appthemes_before_blog_post_title(); |
Example: Advertisment
This code would display an AppThemes banner advertisement above the content of every page.
<?php
function insert_banner_ad_before_post_title() {
echo '<a href="http://www.appthemes.com"><img src="http://www.appthemes.com/ads/at-468x60a.gif"></a>';
}
add_action( 'appthemes_before_blog_post_title', 'insert_banner_ad_before_post_title' );
?> |
Example: Adding an Announcement Bar
You can insert special information for the user about a sale, upcoming event, or other notification here.
<?php
function sale_annoucement() {
echo '<div class="annoucement">' . __( 'Come back July 5th for 10% off everything!', 'appthemes' ) . '</div>';
}
add_action( 'appthemes_before_blog_post_title', 'sale_annoucement' );
?> |
Changelog
Source File
appthemes_before_blog_post_title()
is located in loop.php
.
Runs in the loop.php and loads after the blog post title.
appthemes_after_blog_post_title(); |
Example: Print Date
You can use this space to print meta data, like the date
<?php
function insert_date() {
echo '<p>' . get_the_date() . '</p>';
}
add_action( 'appthemes_after_blog_post_title', 'insert_date' );
?> |
Changelog
Source File
appthemes_after_blog_post_title()
is located in loop.php
.
This action hook executes in the loop.php file and loads right before the_content() is run.
appthemes_before_blog_post_content(); |
Example: Advertisment
This code would display an AppThemes banner advertisement above the content of every blog post.
<?php
function insert_banner_ad_before_post() {
echo '<a href="http://www.appthemes.com"><img src="http://www.appthemes.com/ads/at-468x60a.gif"></a>';
}
add_action( 'appthemes_before_blog_post_content', 'insert_banner_ad_before_page' );
?> |
Example: Adding an Announcement Bar
You can insert special information for the user about a sale, upcoming event, or other notification here.
<?php
function sale_annoucement() {
echo '<div class="annoucement">' . __( 'Come back July 5th for 10% off everything!', 'appthemes' ) . '</div>';
}
add_action( 'appthemes_before_blog_post_content', 'sale_annoucement' );
?> |
Changelog
Source File
appthemes_before_blog_post_content()
is located in loop.php
.
This action hook executes in the loop.php file and loads right after the_content() is run.
appthemes_after_blog_post_content(); |
Example: Author Information
You can use this space to add information about the author or company.
<?php
function insert_company_bio() {
echo '<div class="bio">' . __( 'Example.com is a Southern California based company that specializes in serving up 404 pages.', 'appthemes' ) . '</div>';
}
add_action( 'appthemes_after_blog_post_content', 'insert_company_bio' );
?> |
Example: Share Link
You can use this hook to add meta data to a page, like a share link for social media sites.
<?php
function insert_share_link() {
echo '<div class="share-link">' . __( 'Share this link with your friends!', 'appthemes' ) . '<input type="text" value="' . esc_attr( get_permalink() ) . '">';
}
add_action( 'appthemes_after_blog_post_content', 'insert_share_link' );
?> |
Changelog
Source File
appthemes_after_blog_post_content()
is located in loop.php
.