WordPress.org

Ready to get started?Download WordPress

Forums

Difficulties with featured images (thumbnails) (3 posts)

  1. muskie
    Member
    Posted 7 months ago #

    I've had a lot of trouble with adding this feature to my WordPress theme. First of all I've been using WordPress since 2005 and never used the built in uploader, apparently you must use it to use featured images. After getting that working on my web host, I discovered that I can not stop the featured image from appearing on the post itself. I only wanted the thumbnail to appear on the main page, ie index.php.

    I never added any thumbnail specific code to single.php, here is how it is:

    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    
    		<div class="post" id="post-<?php the_ID(); ?>">
    			<h2><a>" rel="bookmark" title="Permanent Link: <?php the_title(); ?>"><?php the_title(); ?></a></h2>
    			<small><?php the_time('F jS, Y') ?><!-- by <?php the_author() ?> --><!-- By Muskie McKay may be necessary for Google Authorship --></small>
    
    			<div class="entryText">
    				<?php the_content('<p class="serif">Read the rest of this entry ยป</p>'); ?>
    				<?php wp_link_pages(); ?><!-- This is for paginated posts which I never use. -->
    
    				<!-- Next  Prev stuff should be here, but it isn't working... Do I need it? -->
    
    				<p class="postMetadata alt">
    					<small id="postingInformation">
    						This entry was originaly posted
    						on <time datetime="<?php the_time('Y-m-d'); ?>"><?php the_time('F jS, Y'); ?></time>, it was last edited on
    						<time datetime="<?php the_modified_time('Y-m-d'); ?>"><?php the_modified_time('F jS, Y'); ?></time>
    						and is filed under: <?php the_category(', ') ?><?php the_tags(' and tagged: '); ?>.<!-- No whitespace so period is correct. -->
    						<!-- This should only show if you're logged in. -->
    						<?php edit_post_link('Edit this entry.','',''); ?>
    					</small>
    				</p>
    				 <!-- simple line break to help DISQUS work better -->
    			</div>
    
    		</div>
    
    	<?php comments_template(); ?><!-- end of The Loop while -->
    
    	<?php endwhile; else: ?>
    
    		<p>Sorry, no posts matched your criteria.</p>
    
    	<?php endif; ?>

    How can I fix it so the thumbnail doesn't automatically appear at the top of the post when displayed by single.php. Oh yeah here is a link to my blog. I think I'm done hacking on this for the night.

  2. nullvariable
    Member
    Posted 7 months ago #

    Interesting. I do see a minor error in the code you pasted, but not sure that would cause your issue.

    ><a>" rel="bookmark"
    Should read:
    ><a rel="bookmark"

    Are you certain that single.php is the template in use?
    Also is it possible that you have a function in functions.php that overrides something, or a plugin somewhere?

    Last thought, how did you declare support for the thumbnails in your theme?

  3. muskie
    Member
    Posted 7 months ago #

    I think the rel="bookmark" thing is some sort of cut n' paste error. Here is the line from single.php

    <h2><a>" rel="bookmark" title="Permanent Link: <?php the_title(); ?>"><?php the_title(); ?></a></h2>

    As for whether single.php is called to display single posts, what else would be? I can put some sort of HTML comment in.

    Perversely adding an HTML comment to prove single.php is being run, seems to have made the damn featured image disappear from the single post. Low it is still there when index.php is run. I did not add thumbnails to archive.php, that is slightly different than either other code. I'm going to add yet another featured image to a recent post to see if this problem miraculously went away while I watched a Korean gangster movie.

Reply

You must log in to post.

About this Topic