[EventCalendar] Looking backwards in time? - if statements
Steve Logan
steve at bigsmoke.com
Tue Oct 31 11:50:19 UTC 2006
Ahh! Fair cop, gov. Hadn't thought about that...
Alex Tingle wrote:
> Steve,
>
> On 31 Oct 2006, at 11:26, Steve Logan wrote:
>
>> As aside to the main thread...
>>
>>>> <!-- The Loop -->
>>>> <?php if (have_posts()) : ?>
>>>> <?php while (have_posts()) : the_post(); ?>
>>>> <?php if ( in_category($this_cat) ) : ?>
>>> What? Putting an "if ..." inside your loop is not a good idea. Imagine
>>> what happens if the first 10 posts fail your 'if' criterion. If
>>> $this_cat is not 2, then why not...
>>
>> Why is putting an 'if' inside The Loop not a good idea?
>>
>> Surely if a post fails the loop then nothing gets printed. If they
>> all fail then I get nothing printed - which might not be pretty but
>> isn't fatal. Or am I missing something??
>
> You've got WordPress set to show 10 posts per page, right? Now what
> happens if the first ten posts all fail your 'if'? You get no posts
> shown, and your visitor has to click "next page" in the hope that some
> of posts 11-20 pass the test.
>
> The correct way to do this is exclude the unwanted posts in the query.
>
> -Alex
>
>
> _______________________________________________
> Blog: http://wpcal.firetree.net/
> EventCalendar at firetree.net mailing list
> Unsubscribe: http://penguin.firetree.net/eventcalendar
>
--
---------------------------------------------------------------
Dr Steve Logan, engineering software
t: 01764-650085
e: steve at bigsmoke.com
w: www.bigsmoke.com
More information about the EventCalendar
mailing list