I have created a layout for a custom post type. But the front-end only displays the content with the theme's display. I think that there is no the_content() function in single.php that Toolset can override, but how can I sort that?
This is the relevant code in single.php that displays the content that I want to override:
<?php while (have_posts()) : the_post(); ?>
<?php
$panels = get_post_meta(get_the_ID(), 'panels_data', true);
if (!empty($panels) && !empty($panels['grid'])):
get_template_part('content', 'builder');
else:
get_template_part($partial, 'single');
endif;
?>
See for example hidden link
The theme uses get_template_part which is a WordPress native function.
https://developer.wordpress.org/reference/functions/get_template_part/
It allows calling a specific PHP file that determines how the content is shown, hence that is where you would look for the "real" content display function (if any).
There is an easier way, you can head to Toolset > Settings > Front-end Content > Theme support for Content Templates.
https://toolset.com/documentation/user-guides/theme-support-for-content-templates/
If that does not work, you would have to create a child theme and in there, call the_content()
Thanks. I tried the Theme support for Content Templates. The debugging output I get is "Bunyad_Posts::the_content, WP_Hook::apply_filters". If I simply copy all of that and add to box and save, the output on the Events post type page is still from the general theme.
I do have a child theme. Should I simply copy single.php and change that to use the_content() ? I tried it briefly on the main theme, but it output the entire HTML code, although I didn't look at it more carefully.
To create a child theme and alter its template you can follow this guide:
https://codex.wordpress.org/Child_Themes
Your theme will require a child theme since the method of using the inbuilt compatibility for Content Templates will only work if your theme has a proper dedicated function to display the content.
Views will not accept generic PHP functions or auxiliar WordPress functions like:
require, require_once, include, include_once, locate_template, load_template, apply_filters, call_user_func_array.
You will need to create a Child theme according to above DOC and then replace all the files where you want to use Toolset with the content (and content is used/displayed).
Your theme makes usage of get_template_part() which is already made for Child themes usage, it allows you to modify the templates called.