seriously dude, get out of my time zone…
<?php
if (is_category(5)) :
$readposts = get_posts('numberposts=5&category=12');
foreach($readposts as $post) : setup_postdata($post);
?>
[regular post stuff goes here]
<?php
endforeach;
endif;
?>
This should work, barring any tyops.
(I was kidding about the time zone thing… mostly π )
Hahahah, don’t worry, that is the last question. I’m going to become an Insomniac to keep out the time zone thang π
Thank you
haha, you’re welcome… don’t worry, I’m kidding, I wouldn’t be here if I didn’t get some perverse joy out of other people’s suffering.
I mean… I like helping people.
Haha, can’t help but get a kick out of the old suffering game π
I seem to be getting a Parse Error on the ‘endforeach’ part:
Parse error: syntax error, unexpected T_ENDFOREACH
My code:
<?php
if (is_category(5)) :
$readposts = get_posts('numberposts=5&category=12');
foreach($readposts as $post) : setup_postdata($post);
?>
<?php while (have_posts()) : the_post(); ?>
<div class="post">
<h3 id="post-<?php the_ID(); ?>"><?php the_title(); ?></h3>
<small><?php the_time('l, F jS, Y') ?></small>
<div class="entry2" style="margin-right:135px;position:relative;">
<?php the_content() ?>
</div>
</div> <!-- end of post class element -->
<?php
endforeach;
endif;
?>
Promise this is the last time I ask π
ah, its because you’re putting the while loop and stuff in there as well…
I mean lets get that right first, then we’ll know for sure.
put only this part into my code above:
<div class="post">
<h3 id="post-<?php the_ID(); ?>"><?php the_title(); ?></h3>
<small><?php the_time('l, F jS, Y') ?></small>
<div class="entry2" style="margin-right:135px;position:relative;">
<?php the_content() ?>
</div>
</div>
I’ve left out the parts you have got commented there, since they wouldn’t be showing up anyway.
Brilliante, worked a dream π
Thanks
anytime… π
remember to vary the numposts= part, or remove it if you want them all.
Aaaah good call. I’ll probably want to list them all, so may remove that clause.
Thank you.
Is there an is_not_category?
I’ve been trying things like:
if (!in_category(’26’) && !in_category(‘3’) )
if (!is_category(’26’) && !is_category(‘3’) )
but getting nowhere π
Have you experienced this before?
the !is_category should work.. but.. your conditional is kind of odd because no one thing can be both category 26 AND category 3 at the same time.
maybe you want || which is a logical OR…
that way either 26 or 3 are covered.
this assumes you’re actually doing this on a category page as per this thread, and not in a single post or something.
Yes, sorry it should be the || I’m using.
Thank you.
I get those screwed up all the time. If you could see my FTP logs you’d find the same file uploaded 16 times in the same 5 minutes, as I discover yet more brain farts.
hahaha tell me about it, try 200 in an hour π