Custom templating with full-site editor themes?
-
Thank you for this plugin, it is exactly what we needed for our project. Unfortunately we’re facing an issue with data context and/or custom templating, and surprisingly I’ve not been able to find others reporting the same on google. Which makes me think/hope we’re just missing something big. Any and all help is greatly appreciated.
Our setup:
https://tmp2.shinysticker.io/bla-loger/- Tabs each contain an IP block referencing the contents of a specific sub-page
- Each sub-page contains an IP block referencing a CPT “lodge”, which is just a set of ACFs.
- This is where we want to use a custom template part. Preferably a template part, as the sub-page will have other content as well.
Following this tutorial: https://medium.com/@wesmodes/using-wordpress-insert-pages-plugin-with-your-custom-post-types-and-custom-templates-535c141f9635
We find:
- The tutorial assumes templates are php files, but they are htmls in our theme “Twenty Twenty-Three”. Do we need to change theme in order for the plugin to find our custom template, or is there some workaround?
- I created a custom template “single-lodge.html” in the theme’s “parts” directory and added the tutorial’s sample code to it (tweaked* to display a single ACF from the lodge in context). It showed up under Appearance -> Editor -> Template parts, but the editor just seems to interpret the code as a “Custom HTML” block. The HTML content has been wrapped in a <p> tag, which I can remove, but it then fails on save. Tried converting the block to a “Code” block, but the block fails with an error message and saving fails.
Please let me know if there is any way we can make “Insert pages” work with custom content templates on full-site editor themes.
Alternatively we could do away with the CPT, move the ACFs to the sub-pages and view them in the sub-page using ACF Views, but in that case the “content” setting will need to pull ACF data from sub-page context (currently it pulls from page context as per your response here, https://wordpress.org/support/topic/acf-fields-do-reference-the-source-page/)
TYSM for your time!
<?php /** * Template Name: Lodge Template * Template Post Type: lodge * * Template for displaying ACF for a lodge. * * @package understrap */ // Exit if accessed directly. defined( 'ABSPATH' ) || exit; ?> <article <?php post_class(); ?> id="post-<?php the_ID(); ?>"> <div class="entry-content lodge-content"> <div class="image"> <?php $emblem = get_field('emblem'); ?> <?php if ( ! empty ( $emblem ) ): ?> <img src="<?php echo $emblem['url']; ?>" alt="<?php echo $emblem['alt']; ?>" /> <?php endif; ?> </div> <!-- .image --> </div><!-- .entry-content.lodge-content --> </article><!-- #post-## -->
The page I need help with: [log in to see the link]
- The topic ‘Custom templating with full-site editor themes?’ is closed to new replies.