Home User profile
tagDiv Member
This user did not write anything. So we are just showing here some random text to make the profile page look nice :)
mikadim
tagDiv Member

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

mikadim
tagDiv Member

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

Viewing 2 posts - 1 through 2 (of 2 total)