Action Hooks

Action hooks are useful for adding extras so here are list of action hooks that you can use with Auto Load Next Post. All hooks are related to the repeater template file.

The Loop

Use this action hook to display content before the loop.

add_action( 'alnp_load_before_loop', 'your_function_name' );

Use this action hook to display content after the loop.

add_action( 'alnp_load_after_loop', 'your_function_name' );

The Content

Use this action hook to display content before the content.

add_action( 'alnp_load_before_content', 'your_function_name' );

Similar to the one above only this action hook is specific to the post format of the loaded post.

add_action( 'alnp_load_before_content_post_format_' . $post_format, 'your_function_name' );

Use this action hook to display content after the content.

add_action( 'alnp_load_after_content', 'your_function_name' );

Similar to the one above only this action hook is specific to the post format of the loaded post.

add_action( 'alnp_load_after_content_post_format_' . $post_format, 'your_function_name' );

Replace $post_format with one of the supported formats. See Post Formats for a list of supported formats that you can use to display content for a specific post format.

An example of adding content to a specific post format with one of the action hooks.

function your_function_name(){
echo 'This video is awesome. Share it with your friends!';
}
add_action( 'alnp_load_after_content_type_video', 'your_function_name' );

So whenever a post that is formatted for a video, after the content it will display whatever you want it to display.

Info: Not all themes support post formatting but if you are creating a WordPress theme yourself then this would be a great feature to support.

Content for Post Types

Auto Load Next Post Pro will support any post type besides just posts. In prepartion for this, the repeater template file already supports action hooks for post types. Here are the action hooks you can use to display content depending on the post type.

Use this action hook for the post type of your choosing before the content.

add_action( 'alnp_load_before_content_post_type_' . $post_type, 'your_function_name' );

Use this action hook for the post type of your choosing after the content.

add_action( 'alnp_load_after_content_post_type_' . $post_type, 'your_function_name' );

No More Posts

Should Auto Load Next Post attempt to load the very last post again, this action hook can be used to display when there are no futher posts to return.

add_action( 'alnp_no_more_posts', 'your_function_name' );

Testing the Action Hooks

You can use the action hooks demonstration plugin to show you an example of the action hooks in action. Each hook will load depending on your content. Action hooks that load before content are shown in white. Action hooks that load after content are shown in black.