PluginProbe
BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot / 4.9.3
BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot v4.9.3
4.9.3 4.9.2 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 All 201 releases
betterdocs / views / template-parts / category-list-2.php

category-list-2.php in BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot 4.9.3, at views/template-parts/category-list-2.php

54 lines 1.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 // phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- view template receives variables via extract(); prefixing is impractical.
3
4 if ( ! defined( 'ABSPATH' ) ) {
5 exit;
6 }
7 use WPDeveloper\BetterDocs\Utils\Helper;
8
9 $posts = betterdocs()->query->get_posts( $query_args, true );
10
11 if ( ! $posts->have_posts() ) {
12 wp_reset_postdata();
13 }
14
15 $_page_id = null;
16
17 if ( is_single() ) {
18 $_page_id = get_the_ID();
19 }
20 ?>
21
22 <ul class="betterdocs-articles-list">
23 <?php
24
25 if ( '' === $query_args[ 'posts_per_page' ] ) {
26 $query_args[ 'posts_per_page' ] = get_option( 'posts_per_page' );
27 }
28
29 if ( -1 == $query_args[ 'posts_per_page' ] || $query_args[ 'posts_per_page' ] > 0 ) {
30 while ( $posts->have_posts() ):
31 $posts->the_post();
32 $_link_attributes = array(
33 'href' => esc_url( get_the_permalink() )
34 );
35
36 if ( get_the_ID() === $_page_id && Helper::get_tax() != 'doc_category' ) {
37 $_link_attributes[ 'class' ] = 'active';
38 }
39
40 $_link_attributes = betterdocs()->template_helper->get_html_attributes( $_link_attributes );
41
42 echo wp_sprintf(
43 '<li><a %1$s>%2$s</a></li>',
44 $_link_attributes, // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
45 // Same per-item filter as category-list.php (API method badges etc.).
46 apply_filters( 'betterdocs_docs_list_item_title', betterdocs()->template_helper->kses( get_the_title() ), get_the_ID() ), // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
47 );
48 endwhile;
49
50 wp_reset_postdata();
51 }
52 ?>
53 </ul>
54