The Terms extension provides additional functionality for infinite scrolling taxonomy terms with Ajax Load More.

The extension works by using a WP_Term_Query to retrieve taxonomy terms and returns them to Ajax Load More for display.


Repeater Template

Term information must be accessed in a Repeater Template by referencing the $term object.


Shortcode Parameters

Use the following shortcode parameters to initiate a term query with Ajax Load More.

term_query Enable Terms Query. (true/false) Default = ‘false’
term_query_taxonomy The taxonomy slugs to query.
term_query_number The number of terms to return per page. Default = 5
term_query_hide_empty Whether to hide terms not assigned to any posts. Default = true

Note: You can modify or add additional query parameters by using the alm_term_query_args filter.

Example Shortcode[ajax_load_more term_query="true" term_query_taxonomy="category, portfolio-type" term_query_number="8"]

Example

The example below will load terms from the category taxonomy and get all posts associated to each term. Click the Load Terms button to get started.

Shortcode

The following shortcode was used in the example above.

Repeater Template

The following Repeater Template was used in the example above.

 


Filter Hooks

The following Ajax Load More filters are available to support the modification of term query arguments.

alm_term_query_args_{id}

The alm_term_query_args_{id} filter can be used to modify or extend  WP_Term_Query arguments by Ajax Load More instance ID.

This filter requires the following 2 step process:

  1. Set Unique ID – Create a unique ID for your ALM instance by setting a value for the id parameter in the shortcode.
    [ajax_load_more id="category_listing" term_query="true" term_taxonomy="category"]
  2. Add Filter – Create the custom filter and function for this instance by appending the unique ID to the filter name.
    add_filter(‘alm_term_query_args_category_listing’, ‘my_function_name’);

When is this filter useful?

This filter is useful for users who need to extend the available term query shortcode parameters.

Check out the WP_Term_Query docs for details on the available query arguments.