ap_new_comment_btn( integer $post_id, boolean $output = true )
Description #
Return or print new comment button.
Parameters #
- $post_idinteger (Required) Post id.
- $outputboolean (Optional) Return or echo. Default is echo. Default value: true
Source #
File: includes/comments.php
function ap_new_comment_btn( $post_id, $output = true ) { if ( ap_user_can_comment( $post_id ) ) { $html = ''; $btn_args = wp_json_encode( array( 'action' => 'comment_modal', 'post_id' => $post_id, '__nonce' => wp_create_nonce( 'new_comment_' . $post_id ), ) ); $html .= '<a href="#" class="ap-btn-newcomment" aponce="false" apajaxbtn apquery="' . esc_js( $btn_args ) . '">'; $html .= esc_attr__( 'Add a Comment', 'anspress-question-answer' ); $html .= '</a>'; if ( false === $output ) { return $html; } echo $html; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped } }
Expand full source code Collapse full source code View on GitHub: includes/comments.php:452
Add your comment