So NOBODY has any thoughts or even opinions on this?
$page = (get_query_var('page')) ? get_query_var('page') : 1;
if ($page == 1) {
//do your page 1 image thing
} elseif ($page == 2) {
//do your page 2 image thing
} else {
//do whatever you need
}
Related:
Pages
http://justintadlock.com/archives/2007/10/27/wordpress-custom-fields-adding-images-to-posts
Using Custom Fields
http://us2.php.net/manual/en/control-structures.elseif.php
Thanks for that, sorry for sounding dumb but how do I implement that with the code I use…
<?php $thereisimage = get_post_meta($post->ID, image, true);
if($thereisimage){ ?>
<img src="<?php echo get_post_meta($post->ID, image, true); ?>" alt="<?php the_title(); ?>" title="<?php the_title(); ?>"/>
<?php }else{ ?>
<img src="<?php bloginfo('url'); ?>/default.jpg" alt="Default Image" />
<?php } ?>
do you want a different image for every post or every page?
different page of the post… for example I have a post that is 5 pages long, I want to use my custom field to put in the image and then have image 1 display on page 1, image 2 on page 2 etc…
I worked up some quick code so it may be buggy as I haven’t tested it. You’ll have to use the custom fields to set the images by page number.
<?php
$thereisimage = get_post_meta($post->ID, image, true);
$page = (get_query_var('page')) ? get_query_var('page') : 1;
if ($page == 1) { ?>
<img src="<?php echo get_post_meta($post->ID, image1, true); ?>" alt="<?php the_title(); ?>" title="<?php the_title(); ?>"/>
<?php } elseif ($page == 2) { ?>
<img src="<?php echo get_post_meta($post->ID, image2, true); ?>" alt="<?php the_title(); ?>" title="<?php the_title(); ?>"/>
<?php } elseif { ?>
<img src="<?php echo get_post_meta($post->ID, image3, true); ?>" alt="<?php the_title(); ?>" title="<?php the_title(); ?>"/>
<?php } else { ?>
<img src="<?php bloginfo('url'); ?>/default.jpg" alt="Default Image" />
<?php } ?>
To explain, you set you’re thereisimage variable the the page variable. If the user is on page 1 it displays the image with the image1 key, if page two the image2 key and so on and so forth until it runs out of pages or keys, then it displays the default code.
Hope this helps.