ThemeShaper Forums » Thematic


query_posts / showposts => 5 (who have featured image - else not affect 5)

(2 posts)
  • Started 10 years ago by acts7
  • Latest reply from acts7
  • This topic is not a support question
  1. acts7

    I've looked everywhere for a way to do this.
    I can query_posts ($args) no problem.

    So using

               //   HOW MANY to display

    This will simply return 5 posts.

    Then I add an if statement (has_post_thumbnail()).
    However, all this does is use the five latest posts (so if only 2 have post_thumbnail, then only 2 posts show).

    How can I make it not count against the 5 unless it has post_thumbnail

    Posted 10 years ago #
  2. acts7

    How can you ensure that you are delivering 5 posts that definately have thumbnail?
    post 1 (no thumb - so start showposts count over)
    post 2 (has thumb - now only need 4 more posts WITH thumbnail)
    post 3 (yes thumb - count is now 2 posts)
    post 4 (no thumb - count remains at 2 posts)
    post 5 (yes thumb - count now at 3)
    post 6 (yes thumb - count now at 4)
    post 7 (no thumb - count remains at 4)
    post 8 (yes thumb - WE HAVE OUR 5 POSTS! so continue)

    Posted 10 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.