[wp-hackers] need help with loop code
gaarai at gaarai.com
Tue Feb 10 18:48:37 GMT 2009
Here's a code snippet that I have running on my site that can be easily
modified to your situation:
$categories = get_the_category();
if ( empty( $categories ) )
if ( ( 1 === count( $categories ) ) && ( 1 == $categories->cat_ID ) )
Let me know if this works for you.
Jen Simmons wrote:
> Hello hackers,
> I'm writing loop code for home.php, and I'm stuck.
> I started with
> <?php if ( in_category('6') && is_home() ) continue; ?>
> Which excludes all posts with category 6 from the home page. But the
> client wants all posts with cat 6 to print, if they are also makred
> with a second category, and to not show up only if cat 6 is the only
> cat the post has.
> How can I do that?
> In other words, I need the code to read:
> If you have only one category, and that category is #6, then jump
> ahead and don't do this stuff,
> do do this stuff (printing stuff).
> Jen Simmons
> Milkweed Media Design
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
More information about the wp-hackers