Esempio n. 1
0
/**
 * Handle the a-z-listing shortcode.
 * @param  array $atts Provided by WordPress core. Contains the shortcode attributes.
 * @return string      The A-Z Listing HTML.
 */
function a_z_shortcode_handler($atts)
{
    $atts = shortcode_atts(array('column-count' => 1, 'minimum-per-column' => 10, 'heading-level' => 2, 'post-type' => 'page'), $atts, 'a-z-listing');
    $query = array('post_type' => $atts['post-type']);
    $a_z_query = new A_Z_Listing($query);
    return $a_z_query->get_the_listing();
}
Esempio n. 2
0
/**
 * Return the index of posts ordered and segmented alphabetically.
 * @param  WP_Query $query      Option WP_Query of posts to index.
 * @param  integer  $colcount   Optional number of columns to separate the list of posts into.
 * @param  integer  $minpercol  Optional minimum number of posts in each column before starting a new column.
 * @param  integer  $h          Optional Heading-Level number for the section headings. May be 1 thru 7.
 * @return string               The listing html content ready for echoing to the page.
 */
function get_the_a_z_listing($query = null, $colcount = 1, $minpercol = 10, $h = 2)
{
    global $_a_z_listing_object, $_a_z_listing_colcount, $_a_z_listing_minpercol;
    $_a_z_listing_colcount = $colcount;
    $_a_z_listing_minpercol = $minpercol;
    $_a_z_listing_object = new A_Z_Listing($query);
    return $_a_z_listing_object->get_the_listing();
}