if custom post type exist
I want to test if custom post type mobile
exist. I used if custom post type exist in the loop, but it doesn't work. Any suggestion why my code is not working
?php /* The loop */ ?
?php if ( have_posts() ) : ?...
?php while ( have_posts() ) : the_post(); ?
? if( post_type_exists( 'mobiles' ) ) { echo 'The Products post type exists';} ?
?php get_template_part( 'content', get_post_format() ); ?
?pp echo 'The post type is: '. get_post_type( get_the_ID() ); ?
?php endwhile; ?
?php twentythirteen_paging_nav(); ?
?php else : ?
?php get_template_part( 'content', 'none' ); ?
?php endif; ?
Topic function-exists posts customization Wordpress
Category Web