• Resolved nostrada

    (@nostrada)


    Newbie alert!

    I would like to assign a different text layout to a certain page. Within my page.php and within the loop I added the following statement:

    <?php if ( the_ID == 3) { ?>
    make it special
    <?php } else { ?>
    not special
    <?php } ?>

    What happens is that I see the page id being printed on my page and every page is “not special”. How can I check for the page id without it being printed on the page and why is my if statement not working?

    I have tried many variations without much success. I’d appreciate some insight.

    <?php get_header(); ?>
    <!--page.php-->
    <!--include sidebar-->
    <?php include(TEMPLATEPATH."/l_sidebar.php");?>
    <!--main contents-->
    <div id="contentx">
    <div id="content">
        <!--loop-->
        <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    
    	<!--post title-->
    		<h2 id="post-<?php the_ID(); ?>"><?php the_title(); ?></a></h2>
    	    <p class="date"><?php the_time('F j, Y'); ?> </p>
    		<div class="postspace2">
    	</div>
        <!--post with more link -->
        <!--Will need special div class for page=3, which is archives-->
    <?php if (the_ID()== 3) { ?>
    three
     <?php } else { ?>
    more
     <?php } ?>
    
         	<?php the_content('<p class="serif">Read the rest of this page &raquo;</p>'); ?>
                    <!--if you paginate pages-->
    	        <?php link_pages('<p><strong>Pages:</strong> ', '</p>', 'number'); ?>
    	</div>
    	<!--end of post and end of loop-->
    	  <?php endwhile; endif; ?>
    
             <!--edit link-->
    	<?php edit_post_link('Edit this entry.', '<p>', '</p>'); ?>
    </div>
    </div>
    <!--page.php end-->
    
    <!--include footer-->
    <?php get_footer(); ?>
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘check for the_ID()’ is closed to new replies.