a_z_shortcode_handler( array $attributes )

Handle the a-z-listing shortcode


Description


Parameters

$attributes

(array) (Required) Provided by WordPress core. Contains the shortcode attributes.


Return

(string) The A-Z Listing HTML.


Source

File: functions/shortcode.php

function a_z_shortcode_handler( $attributes ) {
	$attributes = shortcode_atts( array(
		'column-count' => 1,
		'minimum-per-column' => 10,
		'heading-level' => 2,
		'post-type' => 'page',
	), $attributes, 'a-z-listing' );

	$post_types = explode( ',', $attributes['post-type'] );
	$post_types = array_unique( $post_types );
	$post_types = array_map( function( $item ) {
		return trim( $item );
	}, $post_types );

	$query = array(
		'post_type' => $post_types
	);
	$a_z_query = new A_Z_Listing( $query );
	return $a_z_query->get_the_listing();
}

Changelog

Changelog
VersionDescription
2.0.0Add parent-term and hide-empty parameters.
1.8.0Fix numbers attribute when selecting to display terms. Add grouping to numbers via attribute. Add alphabet override via new attribute.
1.7.0Add numbers attribute to append or prepend numerics to the listing.
1.0.0Introduced.


User Contributed Notes

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.