ap_featured_post_args( boolean|integer $post_id = false )
Description #
Return set featured question action args.
Parameters #
- $post_idboolean | integer (Optional) Post ID. Default value: false
Source #
File: includes/theme.php
function ap_featured_post_args( $post_id = false ) {
if ( ! is_user_logged_in() || ! ap_user_can_toggle_featured() ) {
return array();
}
if ( false === $post_id ) {
$post_id = get_question_id();
}
$is_featured = ap_is_featured_question( $post_id );
if ( $is_featured ) {
$title = __( 'Unmark this question as featured', 'anspress-question-answer' );
$label = __( 'Unfeature', 'anspress-question-answer' );
} else {
$title = __( 'Mark this question as featured', 'anspress-question-answer' );
$label = __( 'Feature', 'anspress-question-answer' );
}
return array(
'cb' => 'toggle_featured',
'active' => $is_featured,
'query' => array(
'__nonce' => wp_create_nonce( 'set_featured_' . $post_id ),
'post_id' => $post_id,
),
'title' => esc_attr( $title ),
'label' => esc_attr( $label ),
);
}
Expand full source code Collapse full source code View on GitHub: includes/theme.php:906
Add your comment