Custom post types not showing in category page

Posted in: Newspaper
Post count: 3

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

Post count: 27744

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!

Post count: 3

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

Post count: 27744

Hi,

If that code needs to be inserted in functions.php in the mobile theme plugin, you can set it on this file path => wp-content/plugins/td-composer/mobile/functions.php
If need to add in the other file, please let us know.

Thank you!

Post count: 3

Hi,
I think of that solution Anamaria but in the next update, the code will be erased. Is there another solution? Maybe a mobile hook so i can put the code in the child theme?

Thanks, Katerina

Post count: 27744

Hello,

The child theme doesn’t work for the mobile theme and unfortunately, I don’t know another method. Maybe this can be done by a developer as custom work.

We are sorry for the inconvenience!
Thank you for your understanding!

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