Display featured image of post type category
I inherited a website that had a significant number of customized PHP files. I have removed many since, however, this is one of the few that still seemed relevant. The code below displays 1 image at random from a particular post type (gallery) in the website footer.
There was only one post type category prior to me working on the website. Now I have added more gallery categories, but the footer is displaying images from all categories. How can I modify this to show a particular category from the gallery post type?
?php query_posts('orderby=randshowposts=1post_type=gallery');
while ( have_posts() ) : the_post();?
script
jQuery(document).ready(function(){
$voice = '?php $image = wp_get_attachment_image_src( get_post_thumbnail_id($post-ID), medium ); echo $image[0]; ?';
jQuery('.footer-voice').attr('src', $voice);
});
/script
?php endwhile; ?