Design System is here - Read the release post

Learn GeneratePress

Developers

Comments hooks

These hooks fire around the comments area and each individual comment.

Where the comments hooks fire A wireframe of the comments area and a single comment, with each hook labelled where it fires. The same hooks are listed in firing order in the text list below this diagram. Comments area generate_before_comments_container generate_before_comments generate_inside_comments Single comment generate_after_comment_text

Hooks in firing order

  1. generate_before_comments_container
  2. generate_before_comments
  3. generate_inside_comments
  4. generate_after_comment_text

Comments area

generate_before_comments_container

GP Free

The generate_before_comments_container hook appears before the .comments-area element.

Parameters: none. Default: —.

add_action( 'generate_before_comments_container', function() {
    ?>
    <div class="my-notice">Insert your content here.</div>
    <?php
} );

Guide: Blog

generate_before_comments

GP Free

The generate_before_comments hook appears inside the .comments-area element.

Parameters: none. Default: —.

add_action( 'generate_before_comments', function() {
    ?>
    <div class="my-notice">Insert your content here.</div>
    <?php
} );

Guide: Blog

generate_inside_comments

GP Free

The generate_inside_comments hook appears inside the #comments element.

Parameters: none. Default: —.

add_action( 'generate_inside_comments', function() {
    ?>
    <div class="my-notice">Insert your content here.</div>
    <?php
} );

Guide: Blog

Back to top

Single comment

generate_after_comment_text

GP Free

The generate_after_comment_text hook appears just after the .comment-content element.

Parameters: $comment, $args, $depth. Default: —.

add_action( 'generate_after_comment_text', function( $comment, $args, $depth ) {
    ?>
    <div class="my-notice">Insert your content here.</div>
    <?php
} );

Guide: Blog

Back to top