Filter Hooks

The following core Ajax Load More filters are available to support the modification of query arguments and display settings.


Query Filters

alm_query_args_{id}

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

The following snippet should be pasted into your theme’s functions.php file.

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="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.

Dynamic Query Parameters

The following snippet appends a custom Meta Query to fetch events after today by custom field date. The idea with this is this becomes an ever-present query on the specific Ajax Load More instance.

Parsing Querystrings

Build a custom query based on querystring parameters by parsing the URL directly inside the alm_query_args filter.

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


alm_query_after_{id}

The alm_query_after_{id} filter can be used to modify the results of a WP_Query by Ajax Load More instance ID.


alm_allow_future_posts

This filter is used to allow for future posts to be displayed for all users. By default, ALM does not allow for future posts to be displayed for non-admin users.


alm_debug

This filter is used to display the Ajax Load More WP_Query arguments in the browser console. Debug data will be returned in a unique entry labeled alm_debug in the browser console.


alm_disable_noscript_{id}

The alm_disable_noscript_{id} filter can be used to remove the <noscript/> tags that are dynamically generated by the Filters and SEO add-ons.

You can globally disable <noscript/> functionality across all Ajax Load More instances.

alm_repeater_path

The alm_repeater_path filter can be used to change the Repeater Template directory path. By default, Repeater Templates are saved in a alm_templates folder located in the wp-content/uploads directory.


Display Options

alm_after_container

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


alm_after_button

This filter is used to add content after the load more .alm-button-wrap button 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 label on the Ajax Load More button.


alm_button_wrap_classes

This filter is used to add custom HTML classes to the load more button container.


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.


Admin Filters

alm_mask_license_keys

Hide the Ajax Load More license keys on the license entry screen in the WordPress admin.