ap_flag_btn_args( mixed $post = null )
Description #
Flag button html.
Parameters #
- $postmixed (Optional) Post. Default value: null
Source #
File: includes/flag.php
function ap_flag_btn_args( $post = null ) { if ( ! is_user_logged_in() ) { return; } $_post = ap_get_post( $post ); $flagged = ap_is_user_flagged( $_post ); if ( ! $flagged ) { $title = sprintf( /* Translators: %s Question or Answer post type label for flagging question or answer. */ __( 'Flag this %s', 'anspress-question-answer' ), ( 'question' === $_post->post_type ) ? esc_html__( 'question', 'anspress-question-answer' ) : esc_html__( 'answer', 'anspress-question-answer' ) ); } else { $title = sprintf( /* Translators: %s Question or Answer post type label for already flagged question or answer. */ __( 'You have flagged this %s', 'anspress-question-answer' ), ( 'question' === $_post->post_type ) ? esc_html__( 'question', 'anspress-question-answer' ) : esc_html__( 'answer', 'anspress-question-answer' ) ); } $actions['close'] = array( 'cb' => 'flag', 'icon' => 'apicon-check', 'query' => array( '__nonce' => wp_create_nonce( 'flag_' . $_post->ID ), 'post_id' => $_post->ID, ), 'label' => __( 'Flag', 'anspress-question-answer' ), 'title' => $title, 'count' => $_post->flags, 'active' => $flagged, ); return $actions['close']; }
Expand full source code Collapse full source code View on GitHub: includes/flag.php:137
Add your comment