Checking for a ‘sticky post’ type

I am working on “classipress” (a wordpress theme) and I am intend to make that feature (sticky post) come up on the top of the category.

Thus far I have obtained the result needed by using the below script, so for this classipress have two files which deals with category ad lisitng:

Read More
  1. taxonomy-ad_cat.php
  2. loop-ad_listing

taxonomy-ad_cat.php actually passes the current category & calls the loop-ad_listing of that category so I initially call only the sticky post and then call post except of sticky by using below code:

query_posts( array('post_type' => APP_POST_TYPE, APP_TAX_CAT => $term->slug, 'ignore_sticky_posts' => 1, 'paged' => $paged, 'post__in' => get_option('sticky_posts')) );
loop hoes here...

The problem is that I want to check within loop-ad_listing.php that the post__in is sticky or not , because when (as an example) a category currently doesn’t have the listing and it shows the empty message twice. Once for the sticky calling loop & a second for absence of sticky calling loop..

Can you help me implement this correctly in to my posted code based on my description?

Related posts

Leave a Reply

2 comments

  1. Coool…I got the the solution…

    i made another file which is *loop-ad_listing1.php* & in that file i only check if dont have the post show empty message & in the original file which call for the loop whcih is *loop-ad_listing.php* … i remove empty message from it…

    So what i achieve is,

    if i have the ad listings on that page my alternative file show nothing & orignal file shows listing & if dont have ad lisitngs than my duplicate file shows empty message while original file donot show any thing.. cool:)

    While the above mentioned Mihai Stancu trick will also work & preferable if we have only one file for listings.