• Resolved mister5317

    (@mister5317)


    I am trying to create a photoblog with WordPress. I would like to have one picture per page. I would also like the comments to be on that page. Basically, I would like to use the ‘single’ post view for everything. I have tried:
    <?php $wp_query->is_single = true; ?>
    but when I use:
    <?php previous_post_link('&laquo; %title') ?>
    nothing shows up. I would like the homepage to have the one post per page, and show the previous link as the previous post’s title.

    So far I have my template setup the way I want it setup, and have setup WordPress to only display one post per page. Can someone please help me out?

    Thank you!

Viewing 3 replies - 1 through 3 (of 3 total)
  • in your index.php add this before the loop:
    <?php query_posts("showposts=1"); ?>

    Thread Starter mister5317

    (@mister5317)

    That will only show the very fist post. I want just one post per page, and be able to click on the links for previous and next, but have them be the title of the post.

    Here is the code from my index.php file.

    <?php get_header(); ?>
    
    <?php //$wp_query->is_single = true; ?>
    <?php //query_posts("showposts=1"); ?>
    <?php if(have_posts()): ?>
    <?php while(have_posts()) : the_post(); ?>
    
    <?php if(yapb_is_photoblog_post()): ?>
    
    <?php $location = get_post_meta($post->ID, 'location', TRUE); ?>
    
    <!-- Photograph -->
    <div id="content">
      <div id="photo" class="column16">
        <div id="details" class="portrait">
          <h1><?php the_title(); ?></h1>
          <h2 class="subDetails">/<?php the_time('F d, Y') ?> <?php echo !empty($location) ? '/'.$location : '' ?></h2>
          <div class="navLinks">
            <?php previous_post_link() ?>
            | <?php next_post_link() ?>
          </div>
          <p><?php the_content(); ?></p>
          <?php if(get_the_tags()) the_tags('<p class="tags">Tags: ',", ",'</p>'); ?>
          <p class="copyright">Copyright &copy; 2007 - <?php echo date('Y') ?> <a href="<?php echo get_option('home'); ?>"><?php bloginfo('name'); ?></a>. All rights reserved.</p>
        </div>
        <?php yapb_image('', array('alt' => ''), '') ?>
    
      </div>
      <div class="clear"></div>
    </div>
    <?php endif; ?>
    <?php endwhile; ?>
    <?php endif; ?>
    
    <?php get_footer(); ?>
    Thread Starter mister5317

    (@mister5317)

    Got it to work. I could have swore I tried this earlier today…

    <?php get_header(); ?>
    
    <?php $wp_query->is_single = true; ?>
    
    <?php if(have_posts()): ?>
    <?php while(have_posts()) : the_post(); ?>
    
    <?php if(yapb_is_photoblog_post()): ?>
    
    <?php $location = get_post_meta($post->ID, 'location', TRUE); ?>
    
    <!-- Photograph -->
    <div id="content">
      <div id="photo" class="column16">
        <div id="details" class="portrait">
          <h1><?php the_title(); ?></h1>
          <h2 class="subDetails">/<?php the_time('F d, Y') ?> <?php echo !empty($location) ? '/'.$location : '' ?></h2>
          <div class="navLinks">
            <?php previous_post_link() ?>
            | <?php next_post_link() ?>
          </div>
          <p><?php the_content(); ?></p>
          <?php if(get_the_tags()) the_tags('<p class="tags">Tags: ',", ",'</p>'); ?>
          <p class="copyright">Copyright &copy; 2007 - <?php echo date('Y') ?> <a href="<?php echo get_option('home'); ?>"><?php bloginfo('name'); ?></a>. All rights reserved.</p>
        </div>
        <?php yapb_image('', array('alt' => ''), '') ?>
    
      </div>
      <div class="clear"></div>
    </div>
    <?php endif; ?>
    <?php endwhile; ?>
    <?php endif; ?>
    
    <?php get_footer(); ?>
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Photoblog Single Picture Per Page’ is closed to new replies.