• I’d like to set up some conditional tags for if the page showing is the photos page? I can’t get it working correctly, this is in my single post template:

    <?php if ( is_page(‘Photos’))
    {
    <div id=”copy”>
    <?php if (have_posts()) : ?>
    <?php while (have_posts()) : the_post(); ?>
    <div class=”navigation”>
    <div class=”alignleft”>
    <?php previous_post_link(‘« %link’) ?></div>
    <div class=”alignright”>
    <?php next_post_link(‘%link »’) ?></div>
    </div>
    <div class=”post”>
    <?php the_content(); ?>

    </div><!– /post –>
    }
    ?>

Viewing 2 replies - 1 through 2 (of 2 total)
  • This is the way I do it:

    <?php if (is_page('photos')) : ?>
    paste code here...
    <?php endif; ?>

    There are several ways to code conditional tags – I just feel that I have more controll of what’s heppening this way.

    Maby is’s because you have “Photos” insted of “photos”

    ‘not working correctly’ is not the most helpful of comments.
    i assume that your code is in page.php or a page template (not sure what you mean with ‘single post template’?)
    (and you probably had some error message which could have helped here)

    i think you lost the closing php tags in the second line, and an opening php tag before the closing curly bracket – corrected code below:

    <?php if ( is_page('Photos'))
    { ?>
    <div id="copy">
    <?php if (have_posts()) : ?>
    <?php while (have_posts()) : the_post(); ?>
    <div class="navigation">
    <div class="alignleft">
    <?php previous_post_link('? %link') ?></div>
    <div class="alignright">
    <?php next_post_link('%link ?') ?></div>
    </div>
    <div class="post">
    <?php the_content(); ?> 
    
    </div><!-- /post -->
    <?php
    }
    ?>

    btw – when you post code here, please use the ‘code’ button on top of the editor.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Conditional Tag ? Help Please?’ is closed to new replies.