I have a custom loop in the footer showing the last 5 custom posts of the type "books". This works on most pages of the site, but doesn't work on pages using categories.php. On these pages, the custom loop outputs the last 5 posts of all types.
Here's the code:
<?php $loop = new WP_Query( array(
'post_type' => 'books', 'posts_per_page' => 5
) ); ?>
Don't really know where to start. Has to be something to do with categories.php, but the loop itself is in footer.php. I've noticed that deleting, or changing the post_type makes no difference, but posts_per_page does.
Any help with this would be greatly appreciated.