Programmatically Split A Post Into Multiple Pages

We all know that when you're creating a standard post in WordPress you can split the post into multiple pages by adding this code into the text body:

!--nextpage--

Is it possible to split a post up like this programatically? I have a gallery custom post type which only displays attached images, so it's not possible to add the above comment anywhere. I would like the gallery to display n images at a time and then show pagination links. (I'll in fact be using an infinite scroll script but that's irrelevant).

Topic split navigation pages custom-post-types Wordpress

Category Web

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.