AnsPress_Category::categories_page()
Description #
Categories page layout
Source #
File: addons/free/category.php
public static function categories_page() { global $question_categories, $ap_max_num_pages, $ap_per_page; $paged = max( 1, get_query_var( 'paged' ) ); $per_page = ap_opt( 'categories_per_page' ); $total_terms = wp_count_terms( 'question_category', [ 'hide_empty' => false, 'parent' => 0 ] ); $offset = $per_page * ( $paged - 1) ; $ap_max_num_pages = ceil( $total_terms / $per_page ); $order = ap_opt( 'categories_page_order' ) == 'ASC' ? 'ASC' : 'DESC'; $cat_args = array( 'parent' => 0, 'number' => $per_page, 'offset' => $offset, 'hide_empty' => false, 'orderby' => ap_opt( 'categories_page_orderby' ), 'order' => $order, ); /** * Filter applied before getting categories. * * @param array $cat_args `get_terms` arguments. * @since 1.0 */ $cat_args = apply_filters( 'ap_categories_shortcode_args', $cat_args ); $question_categories = get_terms( 'question_category' , $cat_args ); include ap_get_theme_location( 'addons/category/categories.php' ); }
Expand full source code Collapse full source code View on GitHub: addons/free/category.php:117
Add your comment