PluginProbe
BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot / 4.2.0
BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot v4.2.0
4.9.1 4.9.0 4.8.2 4.8.1 4.8.0 4.7.0 4.6.2 4.6.1 4.6.0 4.5.6 4.5.5 4.5.4 4.5.3 4.5.2 4.5.1 4.5.0 4.4.1 4.4.0 3.3.4 3.4.0 3.4.1 3.4.2 3.5.0 3.5.1 3.5.2 All 199 releases
betterdocs / views / templates / authors / author.php

author.php in BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot 4.2.0, at views/templates/authors/author.php

72 lines 2.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 wp_enqueue_style('betterdocs-pagination');
4
5 $author_id = get_query_var( 'author' );
6 $page = get_query_var( 'page' );
7 $enable_pagination = false;
8
9 $default_args = [
10 'post_type' => 'docs',
11 'author' => $author_id,
12 'posts_per_page' => -1
13 ];
14
15 if ( ! empty( $page ) ) { // if page is found enable pagination
16 $default_args['paged'] = $page;
17 $default_args['posts_per_page'] = 10;
18 $enable_pagination = true;
19 }
20
21 $post_query = new WP_Query( $default_args );
22
23 $author_docs_count = count_user_posts( $author_id, 'docs' );
24 $author_name = get_the_author_meta( 'nicename', $author_id );
25 $author_avatar_tag = get_avatar( $author_id, 40 );
26
27
28 get_header();
29
30 ?>
31 <div class="betterdocs-wrapper betterdocs-taxonomy-wrapper betterdocs-archive-layout-7 betterdocs-category-archive-wrapper betterdocs-wraper">
32 <div class="betterdocs-content-wrapper betterdocs-display-flex doc-category-layout-7">
33 <div id="main" class="betterdocs-content-area">
34 <div class="betterdocs-content-inner-area">
35 <?php
36
37 betterdocs()->views->get( 'template-parts/author-header', [
38 'author_name' => $author_name,
39 'author_docs_count' => $author_docs_count,
40 'avatar_tag' => $author_avatar_tag
41 ] );
42
43 betterdocs()->views->get( 'template-parts/author-archive-doc-list', [
44 'post_query' => $post_query
45 ] );
46
47 if ( $enable_pagination ) {
48 global $wp;
49 $remove_the_last_two_vars = explode( '/', $wp->request );
50 $new_link = home_url() .'/'. implode( '/', array_slice( $remove_the_last_two_vars, 0, ( count( $remove_the_last_two_vars ) - 2 ) ) ) . '/';
51 $total_pages = ceil( ( isset( $post_query->found_posts ) ? $post_query->found_posts : 0 ) / 10 );
52
53 betterdocs()->views->get(
54 'template-parts/pagination',
55 [
56 'total_pages' => $total_pages,
57 'link' => $new_link,
58 'current_page' => isset( $page ) ? $page : 1,
59 'template' => 'doc_category' //bypass the template to be used in authors template
60 ]
61 );
62 }
63 ?>
64 </div>
65 </div>
66 </div>
67 </div>
68
69 <?php
70 get_footer();
71 ?>
72