WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Hi I am trying to instegrate a slider into my wordpress theme.This is what I have so far:

                            $slider_query = new WP_Query(array(

                                        if(function_exists('has_post_thumbnail') && has_post_thumbnail()){

While this does work and retrieves the image I need to be able to retribe the url because I have to set different title attributes that are stored for the caption.

I have also tryed to get the URL using

$url = wp_get_attachment_image_src(the_post_thumbnail());

But for som reason the query returns 10 links img's and I set it to 5 only.Wierd thing is that the even images have no source.

Anyone know of a way to retrieve the thumbnail url other then this? If not then why do I get 10 images in the query?

share|improve this question
Dupe of wordpress.stackexchange.com/questions/9175/… – Zach Aug 16 '12 at 19:05
up vote 1 down vote accepted

Just change showposts instead of posts_per_page.

share|improve this answer
A code sample and – more important – an explanation could turn this fragment into an answer. ;) – toscho Aug 16 '12 at 19:25

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.