PluginProbe
BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot / 3.1.0
BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot v3.1.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 / includes / REST / CategoryField.php

CategoryField.php in BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot 3.1.0, at includes/REST/CategoryField.php

25 lines 601 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace WPDeveloper\BetterDocs\REST;
4 use WPDeveloper\BetterDocs\Core\BaseAPI;
5
6 class CategoryField extends BaseAPI {
7 /**
8 * @return mixed
9 */
10 public function register() {
11 $this->register_field( 'doc_category', 'thumbnail', [
12 'get_callback' => [$this, 'thumbnail_image']
13 ] );
14 }
15
16 public function thumbnail_image( $object ) {
17 $attachment_id = get_term_meta( $object['id'], 'doc_category_image-id', true );
18 if ( ! $attachment_id ) {
19 return;
20 }
21
22 return wp_get_attachment_url( $attachment_id );
23 }
24 }
25