Custom post type not showing in (most) VC blocks

Posted in: Newspaper
Post count: 1

Hi everyone,
hope someone could help me.
I created a plugin that registers a custom post type (‘siti’).

Added a filter in the plugin as below:

add_filter('pre_get_posts', 'query_post_type');
function query_post_type($query) {
if ( is_category() || is_tag() || is_home() && empty( $query->query_vars['suppress_filters'] ) ) {
$post_type = get_query_var('post_type');
if($post_type)
$post_type = $post_type;
else
$post_type = array('nav_menu_item', 'post', 'siti');
$query->set('post_type',$post_type);
return $query;
}
}

The custom posts are showing great, as well as the taxonomies archives.
On the homepage, however, the only Visual Composer box that shows the custom posts is the “Big Grid 3” by adding the custom post type in the filter.
If I add for example a “Block 4” nothing happens.

Anyone have an idea?

Installed plugin: Yoast SEO premium, Wordfence, Progress map, Social Buzz.

Thanks in advance,
Marco

Post count: 22421

Hello,

If your custom post type works as expected, all blocks should display it properly. This is the first time we heard of a CPT to work on one block and not work on another. Please also test this with our td_book plugin and see if the blocks work with it properly:

https://forum.tagdiv.com/custom-post-type-support/

Thanks.

Viewing 2 posts - 1 through 2 (of 2 total)
The forum ‘Newspaper’ is closed to new topics and replies.