Filter Hooks

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


alm_after_container

This filter is used to add content or HTML after the Ajax Load More container.


alm_before_button

This filter is used to add content before the load more .alm-button-wrap button container.


alm_before_container

This filter is used to add content or HTML before the Ajax Load More container.


alm_button_label

This filter is used to modify the default ‘Older Posts’ text on the Ajax Load More button.


alm_debug

This filter is used to display the entire Ajax Load More WP_Query result in the browser console. Debug data will be returned in a debug entry of the returned JSON object.


alm_query_args_{id}

The alm_query_args_{id}() filter can be used to modify WP_Query arguments by a specific Ajax Load More instance ID.

The following snippet would be pasted in your theme’s functions.php file.

This filter requires the following 2 step process:

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

When is this filter useful?

This filter is useful for advanced users who prefer to write custom queries over working with shortcode parameters.

Note: Never modify the offset or paged query parameters – these parameters must be set within the core plugin or results may be undesired.

Parsing Query Strings

You can dynamically build a custom query by parsing a query string URL directly inside the alm_query_args filter.

The following snippet retrieves a category value from a query string and adds the category parameter to the $args array.


alm_settings

This filter is used to override the global settings for Ajax Load More.


alm_shortcode_defaults

This filter is used to set global defaults for Ajax Load More parameters. These can be overwritten in the shortcode or the alm_render method.


alm_speed

This filter is used to adjust the global transition speeds of Ajax Load More.