| Server IP : 121.121.20.254 / Your IP : 216.73.216.202 Web Server : Microsoft-IIS/10.0 System : Windows NT WEB-SERVER 10.0 build 20348 (Windows Server 2022) AMD64 User : IUSR ( 0) PHP Version : 8.3.28 Disable Function : NONE MySQL : ON | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : C:/inetpub/wwwroot/KnowledgeBase/wp-content/plugins/betterdocs/includes/Shortcodes/ |
Upload File : |
<?php
namespace WPDeveloper\BetterDocs\Shortcodes;
use WPDeveloper\BetterDocs\Core\Shortcode;
class CategoryList extends Shortcode {
public function get_name() {
return 'betterdocs_category_list';
}
public function get_style_depends() {
return [ 'betterdocs-category-grid-list' ];
}
public function get_script_depends() {
return ['betterdocs-category-grid'];
}
/**
* Summary of default_attributes
* @return array
*/
public function default_attributes() {
return [
'post_type' => 'docs',
'category' => 'doc_category',
'orderby' => $this->settings->get( 'alphabetically_order_post' ),
'order' => $this->settings->get( 'docs_order' ),
'masonry' => '',
'column' => '',
'posts_per_page' => -1,
'nested_subcategory' => '',
'terms' => '',
'terms_orderby' => '',
'terms_order' => '',
'kb_slug' => '',
'multiple_knowledge_base' => false,
'title_tag' => 'h2'
];
}
public function view_params() {
$terms_query = $this->query->terms_query( [
'multiple_kb' => $this->attributes['multiple_knowledge_base'],
'kb_slug' => $this->attributes['kb_slug'],
'terms' => $this->attributes['terms'],
'order' => $this->attributes['terms_order'],
'orderby' => $this->attributes['terms_orderby'],
'nested_subcategory' => (bool) $this->attributes['nested_subcategory']
] );
$docs_query = [
'orderby' => $this->attributes['orderby'],
'order' => $this->attributes['order'],
'posts_per_page' => $this->attributes['posts_per_page']
];
return [
'wrapper_attr' => ['class' => ['betterdocs-category-list-wrapper']],
'inner_wrapper_attr' => ['class' => ['betterdocs-category-list-inner-wrapper']],
'is_edit_mode' => false,
'widget' => $this,
'layout' => 'default',
'default_multiple_kb' => false,
'terms_query_args' => $terms_query,
'docs_query_args' => $docs_query,
'widget_type' => 'category-grid',
'show_header' => true,
'show_list' => true,
'list_icon' => true,
'show_button' => false,
'show_count' => false,
'count_prefix' => '',
'count_suffix_singular' => '',
'count_suffix' => '',
'show_title' => true,
'show_icon' => false
];
}
public function render( $atts, $content = null ) {
$this->views( 'layouts/base' );
}
}