MOON
Server: Apache
System: Linux vps.erhabenn.com.br 3.10.0-1160.119.1.el7.tuxcare.els2.x86_64 #1 SMP Mon Jul 15 12:09:18 UTC 2024 x86_64
User: machen (1008)
PHP: 8.2.31
Disabled: NONE
Upload Files
File: /disk001/machen/public_html/support/wp-content/themes/learnmore/inc/functions/get-categories.php
<?php
if ( ! function_exists( 'learnmore_get_categories' ) ) :
	/**
	 * Returns an array containing all categories [skips the 'Uncategorized' one ] with permalinks.
	 *
	 * Uses WordPress native get_categories function.
	 *
	 * @package LearnMore
	 */
	function learnmore_get_categories() {
		$args = learnmore_get_category_args();
		$categories = get_categories( $args );
		return $categories;
	}
endif;

if ( ! function_exists( 'learnmore_get_category_args' ) ) :

	// Returns $args for 'get_categories' function based on user provided settings.
	function learnmore_get_category_args() {
		$uncategorized_category_id = get_cat_ID( 'Uncategorized' );
		$args = array(
			'orderby'    => get_theme_mod( 'kb_category_orderby', 'name' ),
			'order'      => get_theme_mod( 'kb_category_order', 'ASC' ),
			'hide_empty' => true,
			'exclude'    => $uncategorized_category_id,
			'parent'     => 0, // only top-level terms
		);

		return $args;
	}
endif;