Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

ElectricMan5

macrumors regular
Original poster
Jul 22, 2008
204
0
I wish to exclude the whole "<p class="postmeta"> </p>" section from a certain page. Now, I know how to make it appear on one or more pages, but how do I make it appear on all, but exclude the pages I enter in? I keep
PHP:
<?php if (is_page()) { ?> 
<?php } ?>
in it, because the empty () puts it on every page...

I was trying to use
PHP:
<?php if (is_page(23)) { ?>
//blank space is here, so nothing shows up
<?php } ?>
inside of it, since I don't want it appearing on page 23, but it didn't work.


Here's the code I'm trying to work with:


PHP:
<?php if (is_page()) { ?>   


					<p class="postmeta">	
	

						<a href="<?php comments_link(); ?>" class="comments">Comments (<?php comments_number('0','1','%'); ?>)</a> |		

						<span class="date"><?php the_time('F jS, Y'); ?></span><?php edit_post_link('Edit', ' | ', ''); ?>

					</p>

<?php } ?>


Thanks!
 
I got it :)

Just made the top statement
PHP:
<?php if (is_page('23')) { } else {  ?>

PHP:
<?php if (is_page('23')) { } else {  ?>

					<p class="postmeta">	
	

						<a href="<?php comments_link(); ?>" class="comments">Comments (<?php comments_number('0','1','%'); ?>)</a> |		

						<span class="date"><?php the_time('F jS, Y'); ?></span><?php edit_post_link('Edit', ' | ', ''); ?>

					</p>

<?php } ?>
 
If you want something more succinct the ! lets you invert the condition.
PHP:
<?php if (!is_page('23')) {  ?>
 
Cool, so the ! pretty much makes it mean "exclude page 23 from..."?

Essentially yes. The ! operator inverts the logic. (i.e making the if test for FALSE instead of true.) In your case it turns the if statement into this:

IF page IS NOT 23 then...

instead of IF PAGE is 23 THEN do nothing, ELSE do something.
 
Essentially yes. The ! operator inverts the logic. (i.e making the if test for FALSE instead of true.) In your case it turns the if statement into this:

IF page IS NOT 23 then...

instead of IF PAGE is 23 THEN do nothing, ELSE do something.

Yeah I guess that's a lot simpler. Thanks a lot!
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.