Divi Blog Module is a module in Divi where you can place your blog content anywhere in your WordPress website and in any format. Currently, it does not supports custom post type.
There are plugins to make it possible to use Divi Blog Module for Custom Post Type (CPT). One I found is Divi Custom Post Types, a specialist blog module for your CPTs. It cost $27.75 for a single site. I haven’t tried the plugin.
This how-to guide is to use Divi Blog Module for CPT without using such plugin. I used Custom Post Type UI plugin for creating CPT. I created Testimonial CPT with Testimonial category.
- Create Custom Post Type and check Categories (WP Core).
- Create and set Categories for your Custom Post Types.
- Add the code below to your child theme’s functions.php. Make sure to change
your_cpt
.add_action( 'pre_get_posts', function ( $q ) { if (!is_admin() && $q->is_category()) { $q->set( 'post_type', ['post', 'your_cpt'] ); } });
The code above is to include CPT’s category to the main query involving post type categories.
- Add blog module as usual and include only the category for your CPT.
Vikash
January 20, 2020 at 6:47 amgenius…Thanks for sharing brother.
hungeo
April 22, 2020 at 6:41 amI do not know why, but it does not work for me.
Sean Callanan
May 10, 2020 at 2:33 amThis didn’t work for me. I have added created/added categories to the custom posts when I added them as content, and I had already selected Categories (WP Core) as Taxonomies, I added my cpt to the php snippet and added it to functions.php, but when I add the Blog module and change from Post to my custom post type, the Categories selector in the module goes away just as before. Did I miss something?
antonello
May 18, 2020 at 6:04 pmHello,
I created a new custom post type … and categories … but when I select the new CPT … in the property editor I don’t see the categories.
I tried with your code … but nothing.
If I use a DIVI BLOG EXTRA plugin … I see all
why? where I wrong?
thanks
Antonello
Mark Cunzolo
February 4, 2021 at 6:05 amThis is a lifesaver and works like a charm! Everyone just needs to understand that when they use the blog module they have to leave the post type set as posts. Also, it won’t look like it works on the backend/frontend builder. However, it will load correctly on the true frontend browser.