• Working on a new site that list a bunch of products on the “All Products” page and then when you click on the products it takes you to the individual product page to provide info on just that product.

    The products post is a custom post type that I setup and I created a single.product.php file to hold the individual template for this page, however I’m having some issues. I want this page to not display the featured image that I set for the products. The feature image is designed to be on the “All Products” page but I don’t want this image showing up on the single.product.php page. I’ve read many support post about others wanting to do the same thing and all the answers are to remove a piece of code but I can’t find this code anywhere in my single.product.php.

    Here is the code that is on my single.product.php:

    <?php
    get_header(); ?>
    
    <section id="main" class="container_16 <?php echo (get_post_meta(get_the_ID(), 'show_page_content',true) != 'no') ? '' : 'hide-content'; ?>">
        <div id="post-body" class="<?php echo ts_check_if_any_sidebar('','',''); ?>">
            <div id="post-body-padding">
    			<div class="post-text-full">
    				<?php while ( have_posts() ) : the_post(); ?>
    					<?php if (get_post_meta(get_the_ID(), 'show_page_content',true) != 'no'): ?>
    						<?php get_template_part( 'content', 'page' ); ?>
    					<?php endif; ?>
    				<?php endwhile; // end of the loop. ?>
    			</div>
    		</div>
    	</div>
    </section>
    <?php get_footer(); ?>

    Any help would be greatly appreciated. I’m not a programmer and the theme developer that I purchased it from has been completely unresponsive and it’s extremely frustrating.

    Thanks for your advise!
    Nick

Viewing 3 replies - 1 through 3 (of 3 total)
  • Can you post the contents of content-page.php? If it’s too long, post it to Pastebin and put the link here.

    Thread Starter nfischer83

    (@nfischer83)

    <?php
    ?>
    <?php if (has_post_thumbnail()): ?>
    	<div class='post-img'><?php ts_the_resized_post_thumbnail_sidebar(array('full', 'one-sidebar', 'two-sidebars'),get_the_title()); ?></div>
    <?php endif; ?>
    <?php if (get_post_meta(get_the_ID(), 'show_page_content',true) != 'no'): ?>
    	<?php the_content( ); ?>
    	<?php wp_link_pages( array( 'before' => '<div class="page-links">' . __( 'Pages:', 'sentiment' ), 'after' => '</div>' ) ); ?>
    <?php endif; ?>

    Make a child theme, copy content-page.php to your child theme’s folder, and remove these lines from the copy:

    <?php if (has_post_thumbnail()): ?>
    	<div class='post-img'><?php ts_the_resized_post_thumbnail_sidebar(array('full', 'one-sidebar', 'two-sidebars'),get_the_title()); ?></div>
    <?php endif; ?>

    Be aware that doing this will also remove featured images from any other static pages on your site. This won’t affect your blog (if you have one).

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Prevent Featured Image on Single Post page’ is closed to new replies.