• Using this code that check for a thumbnail and adds it. If there is a thumbnail I also want to show title of post and the post excerpt. i use this code which does not work:

    <div id="1"  >
    <?php if ( function_exists( 'add_theme_support' )  && has_post_thumbnail()) { the_post_thumbnail( array(300,100));} ?>
    	<br>
    		<div id="2">
    		<h3><?php the_title(); ?></h3>
    		<?php if(get_post_meta($post->ID, "desttitle_value", true) && has_post_thumbnail())
    					 		echo "<h2>".get_post_meta($post->ID, "desttitle_value", true)."</h2>";
    	?>
    	</div>
    	<div id="destgo" >
    	<a class="anchor1" href="<?php the_permalink(); ?>" rel="bookmark" title="<?php the_title(); ?>">?<!-- <img src="<?php echo CHILDTEMPLATEIMAGES.'/gothere.png'; ?>" alt="go there button" /> --></a>
    		</div>
    	</div>

    What am I missing here?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Try:

    <div id="one"  >
    <?php if ( has_post_thumbnail() ) the_post_thumbnail( array(300,100)); ?>
    <br />
    <div id="two">
    <h2><?php the_title(); ?></h2>
    <?php if(get_post_meta($post->ID, 'desttitle_value', true) && has_post_thumbnail() ) echo '<h3>' . get_post_meta($post->ID, 'desttitle_value', true) . '</h3>';?>
    </div>
    <div id="destgo" ><a class="anchor1" href="<?php the_permalink(); ?>" rel="bookmark" title="<?php the_title(); ?>"> <!-- <img src="<?php echo CHILDTEMPLATEIMAGES.'/gothere.png'; ?>" alt="go there button" /> --></a></div>
    
    </div>

    Note:
    – you can’t start id names with a numeric
    – your h2 and h3 tags were the wrong way around
    – the correct markup for a line break is <br /> unless you’re using HTML 4.0.1 or earlier

    Thread Starter Rhand

    (@rhand)

    @ Esmi. Thanks! Will try this asap. Fixed all XHTML 1.0 transitional issues already. The IDs used were not not the real ones..

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Shot title and excerpt if has thumbnail’ is closed to new replies.