If you think your modifications are worth sharing, we’d welcome a pull request:
https://github.com/uhm-coe/insert-pages/compare?expand=1
Custom template feature isn’t new. When you edit the shortcode, one of the options for “Display” is “Use a custom template”; it will show all Page Templates registered by your theme, and let you use any of those to render the inserted page:
https://developer.www.ads-software.com/reference/functions/get_page_templates/
Here’s the WordPress primer on creating templates:
https://developer.www.ads-software.com/themes/template-files-section/page-template-files/
And a few notes about custom templates for Insert Pages:
* You won’t want to use get_header()
and get_footer()
in your custom templates, because those will already have been printed on the parent page (no need for them on the inserted page).
* You will want to use the basic loop structure. Insert Pages will just pass the ID of the inserted page into the loop, so all template tags should work as expected.
https://developer.www.ads-software.com/themes/basics/the-loop/
So a basic custom template would like like this:
<?php /* Template Name: Your Custom Template Name */ ?>
<?php while ( have_posts() ) : the_post(); ?>
<div>Your custom content, including any template tags you want to use like <?php the_post_thumbnail(); ?></div>
<?php endwhile; ?>