Skip to content

Shortcode References

Ethan Lin edited this page Nov 7, 2025 · 1 revision

Shortcode

AlphaListing includes a shortcode so you can render the directory without editing templates. The simplest usage outputs the default page listing:

[alphalisting]

Displaying different content types

  • Specific post type:
[alphalisting display="posts" post-type="post"]
  • Filter posts by taxonomy and term:
[alphalisting display="posts" post-type="post" taxonomy="category" terms="my-term-slug"]
  • Show only child pages of a specific page:
[alphalisting display="posts" post-type="page" parent-post="24"]
  • Include descendants of any depth for a page:
[alphalisting display="posts" post-type="page" parent-post="24" get-all-children="yes"]
  • Display taxonomy terms instead of posts:
[alphalisting display="terms" taxonomy="category"]
  • Limit taxonomy terms to a branch of the tree:
[alphalisting display="terms" taxonomy="category" parent-term="42"]
[alphalisting display="terms" taxonomy="category" parent-term="42" get-all-children="yes"]

Customizing the alphabet

  • Override the alphabet:
[alphalisting display="posts" alphabet="Aa,Bb,Cc,Dd,Ee,Ff,Gg,Hh,Ii,Jj,Kk,Ll,Mm,Nn,Oo,Pp,Qq,Rr,Ss,Tt,Uu,Vv,Ww,Xx,Yy,Zz"]
  • Append numbers to the alphabet:
[alphalisting display="posts" numbers="after"]
  • Prepend numbers before the alphabet:
[alphalisting display="posts" numbers="before"]
  • Group all numeric items together:
[alphalisting numbers="after" group-numbers="yes"]
  • Create grouped ranges of letters:
[alphalisting grouping="3"]

All shortcode arguments are optional—omit any attributes you do not need.

Shortcode options

Fine-tune the shortcode with the following attributes. Unless otherwise noted, each attribute accepts a single value.  

Common options

  • display: Choose whether to list posts (posts, default) or taxonomy terms (terms). Any other value falls back to posts.
  • numbers: Show numeric headings before (before) or after (after) the alphabet. Defaults to not displaying numbers and falls back to appending them when set incorrectly.
  • grouping: Group letters together. Provide a number greater than 1 to create ranges (for example, 3 produces A-C, D-F, and so on). Set to numbers to group numerals into 0-9. Invalid values disable grouping.
  • group-numbers: Accepts true, yes, on, or 1 to collect all items that start with a numeral into a single section. Defaults to false.
  • symbols-first: Accepts true, yes, on, or 1 to move the symbol bucket ahead of the alphabet. Defaults to false.
  • alphabet: Override the alphabet used for headings. Provide a comma-separated list where the first character in each group becomes the heading. When omitted, AlphaListing uses a locale-aware default or a translation from GlotPress.

Post listing options

  • post-type: Comma-separated list of post-type slugs to include. Defaults to page.
  • parent-post: Only show posts that are descendants of the given parent post ID. Combine with get-all-children="yes" to include the full hierarchy. Defaults to unset.
  • exclude-posts: Comma-separated list of post IDs to hide. Defaults to unset.
  • taxonomy: When filtering posts by terms, provide the taxonomy slug here. Defaults to unset.
  • terms: When filtering posts, provide the term slugs. Requires the taxonomy attribute and accepts a comma-separated list. Defaults to unset.

Term listing options

  • taxonomy: Comma-separated list of taxonomy slugs to display. Defaults to unset.
  • terms: Only include specific term IDs. Requires the taxonomy attribute and cannot be used with exclude-terms. Defaults to unset.
  • exclude-terms: Comma-separated list of term IDs to hide. Requires the taxonomy attribute and cannot be used with terms. Defaults to unset.
  • parent-term: Restrict the listing to terms descending from this slug. Combine with get-all-children="yes" to include deeper levels. Defaults to unset.
  • get-all-children: Accepts true, yes, on, or 1 to include descendants of any depth when using parent-term. Defaults to false.
  • hide-empty-terms: Accepts true, yes, on, or 1 to suppress terms that have no associated posts. Defaults to false.

Internal options

These values are available for completeness and rarely need adjustment.

  • target: Set a fallback URL for letter links when no matching items exist. Defaults to unset.
  • return: Choose whether the shortcode returns the full listing (listing, default) or just the letter navigation (letters).

Clone this wiki locally