-
Notifications
You must be signed in to change notification settings - Fork 0
PHP Usage
Ethan Lin edited this page Nov 7, 2025
·
1 revision
Use AlphaListing programmatically when building custom templates or theme integrations.
Call the shortcode from PHP and print the returned markup:
<?php
echo do_shortcode( '[alphalisting]' );
?>Pass a complete shortcode string with any attributes you need. This keeps behavior in sync with the documented shortcode options.
If you prefer to bypass shortcodes, call the helper function directly in theme files:
<?php
the_alphalisting( array(
'post_type' => 'page',
) );
?>The argument accepts the same parameters as WP_Query. Provide a single post-type slug or an array of slugs to include multiple post types:
<?php
the_alphalisting( array(
'post_type' => array( 'page', 'post' ),
) );
?>When filtering by taxonomy, supply a tax_query configuration identical to what WP_Query expects.
Place these snippets inside PHP blocks. Omit the opening and closing tags if the surrounding template is already inside PHP mode.