I have registered a custom post type 'featured_post'. I am looking for a way to test if the blog home page has any 'featured_post' posts on it and if it has load a javascript file.
The 'featured_post' posts will make a slider at the top of the blog home page. I had this working using sticky posts but I can't work out how to conditionally load the script if there are posts of CPT 'featured_post'.
This is the code that worked for sticky posts:
if ( is_front_page() && is_sticky() ) {
wp_enqueue_script ('flexslider-js');
}
However this does not seem to work and I don't know why:
if ( is_front_page() && get_post_type('featured_post') ) {
wp_enqueue_script ('flexslider-js');
}
Thanks in advance.