Hi,
I am using the newspaper theme and i have some custom post types in my website. I have created a new category for these custom post types and assigned them to the category, but unfortunately in the frontend category page i can’t see the post under the category.
Example custom post type page: https://kouiz.gr/snax_poll/mavra-mesanuxta-poll/
Example custom post type category page: https://kouiz.gr/category/poll/
Thanks and regards
Katerina
Hello,
Normally it shouldn’t be a problem but in most cases, this issue can be from a plugin conflict, please deactivate ALL plugins except tagDiv plugins, also if you are using a child theme or cache plugin, deactivate them, clear all cache and try again.
Let me know the results!
Thank you!
Hi Anamaria,
Ι have solved the problem with the help of the support of the snax poll plugin.
We used the hook below in the child theme and the problem solved for the desktop version. I need your help so i can apply the same thing in the mobile version (mobile theme plugin).
add_action( ‘pre_get_posts’, function( $query ) {
if ( ! function_exists( ‘snax_get_quiz_post_type’ ) || ! function_exists( ‘snax_get_poll_post_type’ ) ) {
return;
}
if ( is_admin() ) {
return;
}
// Skip for pages.
if ( $query->is_page() ) {
return;
}
// Skip for attachments.
if ( $query->is_attachment() ) {
return;
}
// Skip for custom post types.
// Only “posts” page (is_home) has to be changed.
if ( $query->is_post_type_archive() ) {
return;
}
if ( $query->is_tax() ) {
return;
}
$post_type = $query->get( ‘post_type’ );
// Normalize.
$post_type = ( ” === $post_type ) ? array( ‘post’ ) : (array) $post_type;
// Skip if query is not for “post” type.
if ( ! in_array( ‘post’, $post_type, true ) ) {
return;
}
$post_type[] = snax_get_quiz_post_type();
$post_type[] = snax_get_poll_post_type();
$query->set( ‘post_type’, $post_type );
} );
Thanks,
Katerina