AnsPress_Theme::the_content_single_question( string $content )
Description #
Filter single question content to render [anspress] shortcode.
Parameters #
- $contentstring (Required) Content.
Source #
File: includes/class-theme.php
public static function the_content_single_question( $content ) {
global $ap_shortcode_loaded, $post, $question_rendered;
if ( ! $post || true === $question_rendered ) {
return $content;
}
if ( true !== $ap_shortcode_loaded && is_singular( 'question' ) ) {
return do_shortcode( '[anspress]' );
}
// Check if user have permission.
if ( in_array( $post->post_type, [ 'question', 'answer' ], true ) && ! ap_user_can_read_post( $post->ID, false, $post->post_type ) ) {
return '<p>' . esc_attr__( 'Sorry, you do not have permission to read this post.', 'anspress-question-answer' ) . '</p>';
}
return $content;
}
Expand full source code Collapse full source code View on GitHub: includes/class-theme.php:327
Add your comment