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