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: partials/a-z-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
Version Description
1.8.0 Fix numbers attribute when selecting to display terms. Add grouping to numbers via attribute. Add alphabet override via new attribute.
1.7.0 Add numbers attribute to append or prepend numerics to the listing.
1.0.0 Introduced.


User Contributed Notes

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