| @@ -1,8 +1,12 @@ | ||
| 1 | 1 | <?php |
| 2 | +namespace WPDeveloper\BetterDocs\FrontEnd; | |
| 2 | 3 | |
| 3 | -namespace WPDeveloper\BetterDocs\FrontEnd; | |
| 4 | +if ( ! defined( 'ABSPATH' ) ) { | |
| 5 | + exit; | |
| 6 | +} | |
| 4 | 7 | |
| 8 | + | |
| 5 | 9 | use WPDeveloper\BetterDocs\Utils\Base; |
| 6 | 10 | use WPDeveloper\BetterDocs\Utils\Helper; |
| 7 | 11 | use WPDeveloper\BetterDocs\Core\Settings; |
| 8 | 12 | use WPDeveloper\BetterDocs\Utils\Enqueue; |
| @@ -68,9 +72,13 @@ | ||
| 68 | 72 | $post_type = get_query_var( 'post_type' ) != null ? get_query_var( 'post_type' ) : ''; |
| 69 | 73 | $author_id = get_query_var( 'author' ) != null ? get_query_var( 'author' ) : 0; |
| 70 | 74 | $author_docs_count = count_user_posts( $author_id, 'docs' ); |
| 71 | 75 | |
| 72 | - if ( $post_type == 'docs' && $author_docs_count > 0 ) { | |
| 76 | + // Only override on an actual author archive — otherwise this also fires on | |
| 77 | + // the main docs archive (where $author_id falls back to 0) whenever any doc | |
| 78 | + // has post_author 0, hijacking the docs/MKB archive (and its FSE template) | |
| 79 | + // with the author template. | |
| 80 | + if ( is_author() && $post_type == 'docs' && $author_docs_count > 0 ) { | |
| 73 | 81 | wp_enqueue_style('betterdocs-breadcrumb'); |
| 74 | 82 | $template_path = BETTERDOCS_ABSPATH . 'views/templates/authors/author.php'; |
| 75 | 83 | } |
| 76 | 84 | |
| @@ -314,8 +322,9 @@ | ||
| 314 | 322 | 'betterdocs-reactions', |
| 315 | 323 | 'betterdocsReactionsConfig', |
| 316 | 324 | [ |
| 317 | 325 | 'post_id' => get_the_ID(), |
| 326 | + 'nonce' => wp_create_nonce( 'wp_rest' ), | |
| 318 | 327 | 'FEEDBACK' => [ |
| 319 | 328 | 'DISPLAY' => true, |
| 320 | 329 | 'TEXT' => esc_html__( 'How did you feel?', 'betterdocs' ), |
| 321 | 330 | 'SUCCESS' => betterdocs()->settings->get( 'reaction_feedback_text', __( 'Thanks for your feedback', 'betterdocs' ) ), |