the_ID outside of loop
-
I have set up a custom loop for featured items using this page and have modified it to include an array so that more than one post can later be blocked from appearing again. This is all taking place in my index.php.
see pastebin for example.
I want to display the last 5 posts in the Featured category and display them using a crossfader script to rotate through them. This script needs the ids of the divs to be scrolled and I have created these ids by using
<?php the_ID(); ?>
, and I now need to call these in the javascript(see pastebin again). However, this script needs to be outside the loop for it to work, and<?php the_ID(); ?>
isn’t working because i’m not on a single page, and so the many IDs I need cannot be ‘found’!So my question is this: how can I construct a variable that will record the 5 ids of the last 5 posts in the ‘Featured’ category, so that I can call them again outside the loop.
thanks in advance
Alex
- The topic ‘the_ID outside of loop’ is closed to new replies.