• Hello,
    new to the forum. I have a website I am working on that is having the following issue.
    One of the posts in question is http://www.midwaytrailers.net/342/
    On some of the posts the Featured Image is not displaying and is returning the code from the single.php (Single Post) file.
    This is what is displayed in the post:
    [custom_gallery style=”1″ source=”post=342″ link=”image” description=”1″ size=”100×75″ limit=”18″]

    Below is a full copy of the code from single.php

    <?php
    /* midwayts theme */
    /* single.php: dynamic post template file */
    /* Used: To build single post display */
    /* Heirarchy: http://codex.wordpress.org/Template_Hierarchy */
    ?>

    <? get_header(); ?>

    <div id=”sidebar-left”>
    <? include_once(“includes/sidenav-childcategories.php”); ?>
    </div>

    <div id=”content”>
    <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    <?php $tour_custom_fields = get_post_custom(); ?>
    <div class=”post”>
    <div class=”product-content”>
    “>Back to List
    <h4><?php the_title(); ?></h4>
    <?php
    if (trim($tour_custom_fields[‘item_price’][‘0’]) != “”) { ?>
    <span class=”attribute”>Price: <? echo $tour_custom_fields[‘item_price’][‘0’]; ?></span>
    <?php }
    if (trim($tour_custom_fields[‘item_number’][‘0’]) != “”) { ?>
    <span class=”attribute”>Item Number: <? echo $tour_custom_fields[‘item_number’][‘0’]; ?></span>
    <?php }
    // now we need to get number of post images/thumbnails
    $attachments = get_children(array(
    ‘post_parent’ => $post->ID,
    ‘post_status’ => ‘inherit’,
    ‘post_type’ => ‘attachment’,
    ‘post_mime_type’ => ‘image’,
    ‘numberposts’ => 5, // the number
    ));
    $imgcount = 0;
    foreach($attachments as $attachment_id => $attachment_info) { $imgcount++; $singleimgid = $attachment_id; }
    // one or more images – display photo gallery
    if (has_post_thumbnail() && $imgcount > 1) {
    echo do_shortcode(‘[custom_gallery style=”1″ source=”post=’ . get_the_ID() . ‘” link=”image” description=”1″ size=”100×75″ limit=”18″]’);
    // only single image – display featured image
    } elseif (has_post_thumbnail() && $imgcount > 0) {
    $large_image_url = wp_get_attachment_image_src($singleimgid,’large’);
    echo ‘‘;
    the_post_thumbnail(‘thumbnail’);
    echo ‘
    ‘;
    } ?>
    <?php the_content(); ?>
    </div>
    </div>
    <?php endwhile; ?>
    <?php else : ?>
    <div class=”textcenter”><p class=”red”>Sorry, this listings is unavailable or has been removed, check back soon!</p></div>
    <?php endif; ?>
    <div class=”clear”></div>
    </div>

    <? get_footer(); ?>

  • The topic ‘Featured Image not working on some Posts’ is closed to new replies.