Supporting your theme

Sébastien Dumont edited this page Dec 27, 2016 · 8 revisions

If you have installed the plugin for the first time then you may have seen this notification explaining that you need to declare support for the plugin in order for it to fully work.

Declare Theme Support

The first step in supporting your theme is to declare support for the plugin simply by adding this line to your functions.php file.

add_theme_support('auto-load-next-post');

Once you have done that then you are ready to proceed in completing setting up the plugin if any further actions are required.

How to customize your own template.

Should you need or wish to make a modification to your content-partial.php file. Simply copy the file from the templates folder in the plugin directory and paste it in your theme directory under a new folder called auto-load-next-post. The plugin will then load the content-partial.php file from your theme.

Plugin Directory:

auto-load-next-post/template/content-partial.php

Theme Directory:

your-theme/auto-load-next-post/content-partial.php

When making the modifications to your template file, make sure it follows how your theme loads the content for a single post. Works the same for child-themes too.

To further support your theme there is a filter in the content-partial.php file that you can set the location of your templates.

Example

This is an example to support the theme Twenty Seventeen. DONT NEED TO DO THAT FOR THIS THEME AS IT IS ALREADY DONE!

function my_template_location() {
  return 'template-parts/post/';
}
add_filter('alnp_template_location', 'my_template_location');

Post Navigation

This plays an important part for Auto Load Next Post in order for it to work.

If the theme does not have one on a single post then you need to add a post navigation. Follow the Next and Previous Links guide and your theme will be one step closer to being ready for Auto Load Next Post.

If your theme does have a post navigation then you should be fine, but depending on where you have placed your code, you may find a secondary post navigation appearing after each post that has loaded. It would look just like a link.

To remove it, all you have to do is remove an action hook.

remove_action('alnp_load_after_content', 'auto_load_next_post_navigation', 1, 10);