A while back, I created a news site that uses a thumb on the index page and a larger image on the single post page (styled differently). We don't have the ability to upload images using wp, so we just upload into a folder using DW. I gave the administrator the code to place in the post to display the images accordingly. Therefore, none of the posts have a custom field for 'post-image' or 'post-thumb'. I would like to add these custom fields now for all future posts but need for older posts to continue as originally designed.
I bought Smashing WordPress and found the solution. For some reason, the code from the book seems to have an error according to my color coding in DW. Since I am not a programmer, I can't find the error. Can anyone please help? The error appears to be in the following line:
<?php if ($ncimage !== ") { ?>
Thanks to all.
<?php
$max_entries_per_page = 25;
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
//The Query
query_posts("posts_per_page=6&paged=" . $paged);
if (have_posts()) : while (have_posts()) : the_post(); ?>
<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<div class="home">
<h3><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h3>
<?php $ncimage = get_post_meta($post->ID, 'post-thumb', $single = false); ?>
<?php if ($ncimage !== ") { ?>
<img src="<?php echo $ncimage; ?>" alt="<?php { echo the_title(); } ?>" class="thumb" />
<?php } else { echo "; } ?>
<?php the_content(' more »'); ?>
</div>
<div class="clearer"> </div>
</div>
<?php endwhile; else: ?>
<p><?php _e('Sorry, no posts matched your criteria.'); ?></p>
<?php endif; ?>