Skip Navigation

[Resolved] How do I insert my content template into the divi theme builder layout?

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

This topic contains 1 reply, has 1 voice.

Last updated by ChuckGregory 3 days, 17 hours ago.

Assisted by: Minesh.

Author
Posts
#2859777
without body template.jpg
with body template.jpg

Tell us what you are trying to do? I'm building a Newsletter post type. I figured out how to create a content template that shows my related posts, but I don't know how to put it into the theme builder template so that I can style it with Divi

Is there any documentation that you are following? hidden link

Is there a similar example that we can see? no

What is the link to your site? hidden link

I've tried this with and without a body template in the Divi Theme Builder. Attached are two screenshots showing the results of the two methods.

Using body template: I get three copies of the newsletter body instead of the output from the content template. I could style this using Divi (adjust the max width, for example) but it's the wrong content so I didn't bother.

Without body template: I get something closer to what I want but I can't style it in Divi. The things that are wrong: sidebar area was added, title, meta, and featured image were added, I can't adjust width in Divi.

#2859791

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

Here is the doc that shows information how you can use divi with Toolset:
- https://toolset.com/course-lesson/using-toolset-with-divi/

But the thing is that there is many compatibility issues with the release of Divi 5. I strongly recomond that instead of Divi you should go with the Toolset content template and build it using blocks or classic mode instead.

#2860188

I realized that I could use the Divi FilterGrid plugin, which was already installed on this site, to implement the display I needed. There's a custom query option that works perfectly.

Here's the code I added (you'll notice a few things commented out that I needed while getting it to work):
/* custom query for filter grid for newsletters */
function dp_dfg_custom_query_function($args, $props) {
// print_r($props);
/* get the current post id */
$nlpostid = $props['the_ID'];
// $nlpostid = '987457465';
//echo 'nlpostid ='.$nlpostid.'
';
/* Now get the newsletter_items */
$nlitems = toolset_get_related_posts(
$nlpostid,
'newsletter-post',
[
'query_by_role' => 'parent',
'orderby' => 'item-order',
'order' => 'ASC'
]
);
// $args['post__in'] = '';
if ( $nlitems ){
$loopindex = 0;
foreach ( $nlitems as $nlitem ){
$args['post__in'][$loopindex++] = $nlitem;
}
}

// print_r($args);
return $args;
}
add_filter('dpdfg_custom_query_args', 'dp_dfg_custom_query_function', 10, 2);