astra_get_category_list( string $filter_name, string $style_type_slug, bool $post_meta )

Get category List.


Description


Parameters

$filter_name

(string) (Required) Filter name.

$style_type_slug

(string) (Required) Style slug.

$post_meta

(bool) (Required) Post meta.


Return

(mixed) Markup.


Source

File: inc/blog/blog-config.php

function astra_get_category_list( $filter_name, $style_type_slug, $post_meta ) {
	$style_type_class = '';
	$separator        = ', ';
	$categories_list  = '';

	$style_type       = astra_get_option( $style_type_slug );
	$separator        = 'badge' === $style_type ? ' ' : $separator;
	$style_type_class = ' ' . $style_type;
	/* translators: used between list items, there is a space after the comma */
	$get_category_html = get_the_category_list( apply_filters( 'astra_' . $filter_name, $separator ) );
	if ( $get_category_html ) {
		if ( 'badge' === $style_type ) {
			/** @psalm-suppress PossiblyInvalidArgument */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
			$categories_list = str_replace( '<a', '<a class="ast-button"', $get_category_html );
		} else {
			$categories_list = $get_category_html;
		}
	}

	$post_tax_class = $post_meta ? 'ast-blog-single-element ' : '';

	if ( $categories_list ) {
		return '<span class="' . $post_tax_class . 'ast-taxonomy-container cat-links' . $style_type_class . '">' . $categories_list . '</span>';
	} else {
		return '';
	}
}

Changelog

Changelog
Version Description
4.6.0 Introduced.


User Contributed Notes

You must log in before being able to contribute a note or feedback.