Hello,
I have created a function that returns a specific authors 5 most popular posts (reading the popularity data directly from the DB as recorded by the Top 10 plugin). Previously I was having an excerpt created by truncating the post content however I need to alter this to only do this if an excerpt isn't set. After modifying the code to what you see below, it shows an excerpt if the length of post_excerpt is greater than 6 characters but if not it shows the same excerpt (which seems to be coming from one of the posts that isn't even in the result set) for every other result. I'm usually quite good at troubleshooting this kind of thing but I've hit a wall with this.
The code:
[code moderated per forum rules - please follow http://codex.wordpress.org/Forum_Welcome#Posting_Code ]
The fact this is returning an excerpt that isn't even in the result set (incidentally it's 'Hello!') is making me think it's a duplication of variables from somewhere else in my function/plugin structure but for the life of me I can't find it. I have also tried prefixing all of the common-looking variables with mp_ in an attempt to sort this - no luck!
I'd be grateful for any help.
Thanks,
Sean