WordPress.org

Support

Support » How-To and Troubleshooting » Conditional for ‘if page 1 of post’?

Conditional for ‘if page 1 of post’?

Viewing 6 replies - 1 through 6 (of 6 total)
  • This should do the trick:

    $paged = get_query_var('paged');
    if ($paged < 2) {
    // you're on page 1, put your code here
    }

    Thanks!

    I tried to put it into single.php but the panorama shows on all pages. Here’s my code:
    <?php
    $paged = get_query_var('paged');
    if ($paged < 2) { ?>

    <?php if ( get_post_meta($post->ID, 'panorama_url', true) ) { ?><center>
    <applet archive="http://timwheatley.org/global/ptviewer.jar" code=ptviewer.class width=508 height=300 alt="Please install the Java Virtual Machine plug-in from www.java.com."><param name=file value="<?php echo get_post_meta($post->ID, "panorama_url", $single = true); ?>"></applet></center><div id="footer"><center>Click on the image and move your mouse to look around.<?php if ( get_post_meta($post->ID, 'panorama_size', true) ) { ?> Size: <?php echo get_post_meta($post->ID, "panorama_size", $single = true); ?><?php } ?>
    You may also use the - and + keys to zoom in and out.</center></div>
    <?php } ?>

    <?php } ?>

    Try “page” instead of “paged”. See if that works.

    Could be a WordPress bug there. I’m investigating.

    That works. 🙂

    Ah, one thing. It replaces the whole body of the posts page 1, not just the section I put the code around?

    I have no idea there. Likely you put the brackets around the wrong piece of code. The code I gave you does nothing at all, replaces nothing at all.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Conditional for ‘if page 1 of post’?’ is closed to new replies.
Skip to toolbar